math / data /lean /OAI /NumberTheory /TwoPoint /Walks /ClosedWordStateMask.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
4.77 kB
import OAI.NumberTheory.TwoPoint.Bounds.ActualWordStateIdentity
import OAI.NumberTheory.TwoPoint.Bounds.ShiftedIntegerPaths
namespace OAI
/-! The actual closed masked word is its finite-state coefficient times
one indicator for survival of all its vertices. -/
namespace TwoPointCorrelations
open Finset
open scoped Classical
lemma wordVertexSite_closed {R : β„•} (h : β„•) (step : Fin R β†’ SignedStep) (n : β„€)
(hclosed : wordDisplacement h (List.ofFn step) = 0) :
wordVertexSite h step n (Fin.last R) = wordVertexSite h step n 0 := by
simp [wordVertexSite, List.take_of_length_le (by simp : (List.ofFn step).length ≀ R), hclosed]
lemma closed_word_vertex_iff {R : β„•} (hR : 0 < R) (h : β„•)
(step : Fin R β†’ SignedStep) (n : β„€)
(hclosed : wordDisplacement h (List.ofFn step) = 0) (keep : β„€ β†’ Prop) :
(βˆ€ i : Fin R, keep (wordVertexSite h step n i.castSucc)) ↔
βˆ€ i : Fin (R + 1), keep (wordVertexSite h step n i) := by
constructor
Β· intro hi i
by_cases hb : i.val < R
· have he : (⟨i.val, hb⟩ : Fin R).castSucc = i := Fin.ext rfl
simpa only [he] using hi ⟨i.val, hb⟩
Β· have he : i = Fin.last R := Fin.ext (by simp only [Fin.val_last]; omega)
rw [he, wordVertexSite_closed h step n hclosed]
exact hi ⟨0, hR⟩
Β· intro hi i
exact hi i.castSucc
lemma closed_word_mask {R : β„•} (hR : 0 < R) (h : β„•)
(step : Fin R β†’ SignedStep) (n : β„€)
(hclosed : wordDisplacement h (List.ofFn step) = 0) (keep : β„€ β†’ Prop) :
scalarWalkProduct h (fun _ z => vertexIndicator keep z) n (List.ofFn step) =
if βˆ€ i : Fin (R + 1), keep (wordVertexSite h step n i) then 1 else 0 := by
rw [scalarWalkProduct_ofFn]
change (∏ i : Fin R, vertexIndicator keep (wordVertexSite h step n i.castSucc)) = _
by_cases hv : βˆ€ i : Fin R, keep (wordVertexSite h step n i.castSucc)
Β· have hv' := (closed_word_vertex_iff hR h step n hclosed keep).mp hv
simp [vertexIndicator, hv, hv']
Β· have hv' : Β¬βˆ€ i : Fin (R + 1), keep (wordVertexSite h step n i) :=
fun hh => hv ((closed_word_vertex_iff hR h step n hclosed keep).mpr hh)
rw [ite_eq_right hv']
obtain ⟨i, hi⟩ := not_forall.mp hv
exact prod_eq_zero (mem_univ i) (by simp [vertexIndicator, hi])
lemma closed_actual_word_state {J R m : β„•} {P : Fin J β†’ Finset β„•}
(w : ColumnPrimeAssignment J R P) (forward : Fin R β†’ Bool) (padding : Fin R β†’ β„•)
(hprime : βˆ€ j, βˆ€ p ∈ P j, p.Prime)
(hdisjoint : βˆ€ j l, l β‰  j β†’ Disjoint (P j) (P l))
(Qp Q : Finset β„•) (hQp : βˆ€ p ∈ Qp, p.Prime) (hQ : Q βŠ† retainedPrimeDivisors Qp)
(e : Fin m ≃ Qp) (eligible : β„• β†’ β„• β†’ Prop) (L K : ℝ) (h : β„•) (n : β„€)
(hR : 0 < R) (hclosed : wordDisplacement h (columnTupleWord w forward padding) = 0)
(keep : β„€ β†’ Prop) :
let step := fun i => SignedStep.mk (forward i) (columnTuple w i) (padding i)
scalarWalkProduct h
(maskedSignedIntegerWeight Q actualPaddingCoefficient eligible (actualPaddingVertex Qp)
(fun d => centeredTuple d.primeFactors) L K (fun _ => actualPaddingDegreeCut Qp L) h keep)
n (List.ofFn step) =
if βˆ€ i : Fin (R + 1), keep (wordVertexSite h step n i) then
actualWordCoefficient Qp Q e (fun t => eligible t.tuple) L K step (fun i j => (w j i).val)
(fun i => paddingActiveState Qp e (wordVertexSite h step n i)) (wordCenteredBits w h step n)
else 0 := by
dsimp only
rw [show maskedSignedIntegerWeight Q actualPaddingCoefficient eligible (actualPaddingVertex Qp)
(fun d => centeredTuple d.primeFactors) L K (fun _ => actualPaddingDegreeCut Qp L) h keep =
fun t z => vertexIndicator keep z *
signedIntegerWeight Q actualPaddingCoefficient (eligible t.tuple) (actualPaddingVertex Qp)
(centeredTuple t.tuple.primeFactors) L K (actualPaddingDegreeCut Qp L) h t z *
vertexIndicator keep (z + t.displacement h) from rfl]
rw [closed_masked_scalar_word hR h _ n hclosed _ _
(fun z => by unfold vertexIndicator; split_ifs <;> simp)]
rw [closed_signed_word_factorization Q actualPaddingCoefficient (fun t => eligible t.tuple)
(actualPaddingVertex Qp) (fun t => centeredTuple t.tuple.primeFactors) L K
(fun _ => actualPaddingDegreeCut Qp L) h n
(List.ofFn (fun i => SignedStep.mk (forward i) (columnTuple w i) (padding i)))
(actualPaddingVertex_ne_zero Qp)
(fun t q _ z => centeredTuple_padding_periodic t.tuple.primeFactors h t.tuple
(fun p hp => (Nat.mem_primeFactors.mp hp).2.1) q z) hclosed]
rw [← actualWordCoefficient_integer_identity w forward padding hprime hdisjoint Qp Q hQp hQ e]
rw [closed_word_mask hR h _ n hclosed keep]
split_ifs <;> simp
end TwoPointCorrelations
end OAI