math / data /lean /OAI /NumberTheory /TwoPoint /Walks /BlockEdgeForm.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
2.42 kB
import OAI.NumberTheory.TwoPoint.Walks.BlockEndpointSum
namespace OAI
/-! The finite directed matrix form is the overlapping edge-block sum
used in the prefix comparison, with no residual multiplicity assumption. -/
namespace TwoPointCorrelations
open Finset
open scoped Classical
theorem directed_block_form_eq {E : Type*} [Fintype E] (r : E β†’ β„•)
(F : E β†’ β„€ β†’ β„€ β†’ β„‚)
(hsupport : βˆ€ (e : E) (n m : β„€), m β‰  n + r e β†’ F e n m = 0) (M t : β„•) :
(βˆ‘ e : E, βˆ‘ i : Fin M, βˆ‘ j : Fin M,
F e ((i.val : β„€) + (t + 2 : β„•)) ((j.val : β„€) + (t + 2 : β„•))) =
edgeBlockSum univ r (fun e n => F e n ((n : β„€) + r e)) M t := by
let g (i : β„•) := βˆ‘ e : E, if i + r e < M then
F e ((i : β„€) + (t + 2 : β„•)) ((i : β„€) + (t + 2 : β„•) + r e) else 0
calc
_ = βˆ‘ i : Fin M, βˆ‘ e : E, βˆ‘ j : Fin M,
F e ((i.val : β„€) + (t + 2 : β„•)) ((j.val : β„€) + (t + 2 : β„•)) := sum_comm
_ = βˆ‘ i : Fin M, g i.val := by
apply sum_congr rfl
intro i _
apply sum_congr rfl
intro e _
exact block_supported_edge_sum M (r e) (t + 2 : β„•) (F e) (hsupport e) i
_ = βˆ‘ i ∈ range M, g i := Fin.sum_univ_eq_sum_range g M
_ = _ := by
unfold edgeBlockSum g
apply sum_congr rfl
intro i _
apply sum_congr rfl
intro e _
have he : i + r e < M ↔ i + 1 + r e ≀ M := by omega
simp only [he, Nat.cast_add, Nat.cast_ofNat]
simp only [add_assoc, add_left_comm, add_comm]
theorem directed_block_form_prefix_error {E : Type*} [Fintype E]
(r : E β†’ β„•) (F : E β†’ β„€ β†’ β„€ β†’ β„‚)
(hsupport : βˆ€ (e : E) (n m : β„€), m β‰  n + r e β†’ F e n m = 0)
(M R N : β„•) (hM : 0 < M) (hN : 0 < N) (D : ℝ) (hD : 0 ≀ D)
(hr : βˆ€ e, r e ≀ R)
(hrow : βˆ€ n : β„•, 0 < n β†’ (βˆ‘ e : E, β€–F e n ((n : β„€) + r e)β€–) ≀ D) :
β€–((βˆ‘ t ∈ range N, βˆ‘ e : E, βˆ‘ i : Fin M, βˆ‘ j : Fin M,
F e ((i.val : β„€) + (t + 2 : β„•)) ((j.val : β„€) + (t + 2 : β„•))) / (M : β„‚)) / (N : β„‚) -
positivePrefix (fun n => βˆ‘ e : E, F e n ((n : β„€) + r e)) N / (N : β„‚)β€– ≀
(R : ℝ) / M * D + 2 * (M : ℝ) / N * D := by
have hb := edgeBlockSum_prefix_error univ r (fun e n => F e n ((n : β„€) + r e))
M R N hM hN D hD (fun e _ => hr e) hrow
simpa only [directed_block_form_eq r F hsupport] using hb
end TwoPointCorrelations
end OAI