import OAI.Computability.StarHeight.LateSchedule namespace OAI namespace GeneralizedStarHeight universe u universe uAlphabet uM uV uK uP uC uAlphabet2 uM2 universe uV2 uK2 uP2 uC2 uAlphabet3 uM3 uV3 uK3 universe uP3 uC3 uAlphabet4 uJ uC4 uAlphabet5 uT uP4 universe uC5 namespace OuterStream open SplitMetadata WordIntervals LocalMarkers BoundarySnapshot open scoped Classical variable {Alphabet : Type uAlphabet} {M : Type uM} {V : Type uV} {K : Type uK} {P : Type uP} {C : Type uC} [Monoid M] [Field K] [AddCommGroup V] [Module K V] [Fintype M] [Fintype V] [Fintype P] [Fintype C] {g : ℕ} variable (A : ExceptionalOrigins.Parameters Alphabet (Fin (g+1)) C) (H : Cuts g A.B) (clock : RobustClock.Specification (Tag M V g A.B) P C) (T : FreeMonoid Alphabet →* M) (ρ : M → (V →ₗ[K] V)) (β : M → M → (Fin g → M) → V) omit [Monoid M] [AddCommGroup V] [Fintype M] [Fintype V] [Fintype C] in lemma Cuts.multiple (G : Geometry A H) {h : ℤ} (hh : h ∈ H.offsets) : (A.B:ℤ) ∣ h := by obtain ⟨role,_,hh⟩ := Finset.mem_biUnion.mp hh obtain ⟨n,_,rfl⟩ := Finset.mem_image.mp hh exact dvd_add (G.multiple role) (dvd_mul_left _ _) omit [Monoid M] [AddCommGroup V] [Fintype M] [Fintype V] [Fintype C] in lemma available_guard (G : Geometry A H) (hwidth : ∀ h ∈ H.offsets, ∀ h' ∈ H.offsets, |h-h'| ≤ A.w) {t k b Q reference : ℤ} {f : ℤ → Alphabet} {tag : Tag M V g A.B} (hc : ∃ a : ℕ, a < H.count (H.tagRole tag) ∧ k=t+H.base (H.tagRole tag)+a*A.B) (hr : reference ∈ H.offsets) (hn : ¬A.Failed f t Q) (he : EpisodeEnd.EndAt A.endRule.d A.endRule.K A.endRule.tail f (t+A.endRule.offset) (A.endRule.small f (t+A.endRule.offset)) b) : A.endRule.Guard (H.origins k) (k-reference) k b f ∧ suffixAnchor A reference k b f = A.anchor f (b-A.endRule.tail) t := by have hm : k-reference ∈ H.origins k := Finset.mem_image.mpr ⟨reference,hr,rfl⟩ have hstable : ∀ o ∈ H.origins k, A.endRule.small f (o+A.endRule.offset) = A.endRule.small f (t+A.endRule.offset) ∧ A.endRule.large f (o+A.endRule.offset) = A.endRule.large f (t+A.endRule.offset) := by intro o ho obtain ⟨a,ha,hk⟩ := hc obtain ⟨h,hh,rfl⟩ := Finset.mem_image.mp ho have hmem := H.offset_mem (H.tagRole tag) a ha have heq : k-h = t+(H.base (H.tagRole tag)+a*A.B-h) := by omega rw [heq] exact A.not_failed_end hn (hwidth _ hmem h hh) (dvd_sub (H.multiple A G hmem) (H.multiple A G hh)) have hover := G.origin_overlap hc hm refine ⟨A.endRule.guard_available hm (G.actual_visibility hc he) hstable hover.1 hover.2 he,?_⟩ simp only [suffixAnchor,ExceptionalOrigins.Parameters.anchor,(hstable _ hm).2] end OuterStream namespace OuterStream open SplitMetadata WordIntervals LocalMarkers BoundarySnapshot open scoped Classical variable {Alphabet : Type uAlphabet2} {M : Type uM2} {V : Type uV2} {K : Type uK2} {P : Type uP2} {C : Type uC2} [Monoid M] [Field K] [AddCommGroup V] [Module K V] [Fintype M] [Fintype V] [Fintype P] [Fintype C] {g : ℕ} variable (A : ExceptionalOrigins.Parameters Alphabet (Fin (g+1)) C) (H : Cuts g A.B) (clock : RobustClock.Specification (Tag M V g A.B) P C) (T : FreeMonoid Alphabet →* M) (ρ : M → (V →ₗ[K] V)) (β : M → M → (Fin g → M) → V) lemma net_displacement {B R a a' : ℕ} (ha : a rfl) intro i _ exact (hsref i).symm refine ⟨tag,k,hx,hprefix,hsuffix,?_⟩ change tag.output = ClockAffine.update clock ρ β Tag.input Tag.output (A.φ (q-t)) (actual T f s b (search A f u t)) x simp only [ClockAffine.update,ClockAffine.shift,ClockAffine.no_off_outside clock hz] cases hboundaries : (actual T f s b (search A f u t)).boundaries <;> simpa only [hboundaries] using hout end OuterStream namespace OuterStream open SplitMetadata WordIntervals LocalMarkers BoundarySnapshot open scoped Classical variable {Alphabet : Type uAlphabet3} {M : Type uM3} {V : Type uV3} {K : Type uK3} {P : Type uP3} {C : Type uC3} [Monoid M] [Field K] [AddCommGroup V] [Module K V] [Fintype M] [Fintype V] [Fintype P] [Fintype C] {g : ℕ} variable (A : ExceptionalOrigins.Parameters Alphabet (Fin (g+1)) C) (H : Cuts g A.B) (clock : RobustClock.Specification (Tag M V g A.B) P C) (T : FreeMonoid Alphabet →* M) (ρ : M → (V →ₗ[K] V)) (β : M → M → (Fin g → M) → V) lemma available_periodic (G : Geometry A H) (hW : A.W=clock.W) (hnet : ∀ v : C → RobustClock.Circle, ∃ a : ℕ, a S.inner.boundary j.val):ℤ)+ (absoluteBound S.inner.H:ℤ)+|S.inner.extension|+ (3*(innerD S.p (B*S.R))^2+1:ℕ)+(size*innerD S.p (B*S.R):ℕ) := by positivity dsimp only [envelope] omega lemma cut_bounds {f : ℤ → Alphabet} {s b a : ℤ} (ha : a ∈ (S.cuts g).offsets) (he : EpisodeEnd.EndAt L.endRule.d L.endRule.K L.endRule.tail f (s+L.lag+L.endRule.offset) (L.endRule.small f (s+L.lag+L.endRule.offset)) b) : s omega lemma shifted_inner_visible (hB : 0