prioritized_borel_time_dependent_monitor_preserves_ambiguous_loops
At each public round an arbitrary finite monitor updates from the choice of a low or high returning walk. Even when the update can depend on the round, there are a reachable memory state and increasing cut times such that every block can return to that state either on all low walks or using at least one high walk.
Statement
theorem prioritized_borel_time_dependent_monitor_preserves_ambiguous_loops {M : Type} [Finite M] (δ : ℕ → M → Bool → M) (init : M) : ∃ (s : ℕ → ℕ) (m : M) (pre : List Bool), StrictMono s ∧ pre.length = s 0 ∧ op1385TimedMonitorRun δ 0 init pre = m ∧ ∀ n, ∃ w : List Bool, w.length = s (n+1)-s n ∧ true ∈ w ∧ op1385TimedMonitorRun δ (s n) m w = m ∧ op1385TimedMonitorRun δ (s n) m (List.replicate w.length false) = m
- Source
- OP-1385, experiment 44527, and the two returning walks in the lower-bound game of arXiv:2611.10136, Proposition 41. Finite transition functions and infinite homogeneous interval factorization.
- Verified
- 29 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- Cslib.infinite_graph_ramseyIf the edges of an infinite complete graph is assigned a finite number of colors, then there must exist a color
cand an infinite set…
- Cslib.infinite_graph_ramseyIf the edges of an infinite complete graph is assigned a finite number of colors, then there must exist a color
The proof, explained
The argument constructs ambiguous loops for a time-dependent finite monitor by combining the infinite Ramsey theorem with finite-state periodicity. First, helper results establish that monitor executions compose associatively across concatenated words and that concatenating high-step blocks iterates the single-block effect. Applying the infinite Ramsey theorem for pairs colors the round intervals by their low-walk and high-walk state transformations, extracting a strictly increasing sequence of rounds on which both transitions are constant (L, H) and satisfy the absorption law L(H(m)) = H(m). Because the state space is finite, the high-step transition has a periodic point, yielding a state m that is both periodic under high blocks and fixed by low walks. Placing cut times along an arithmetic progression in the Ramsey sequence ensures that every block interval loops m back to m either on all-low walks or via a word containing a high step.
Running the monitor on a concatenated list xs ++ ys decomposes into running xs from time t, then running ys from time t + xs.length starting at the resulting state.
We proceed by induction on xs, generalizing over the initial round t and memory state m. In the base case xs = [], the run leaves the state unchanged at round t + 0. In the inductive step xs = b :: xs', the head input b updates the state to δ t m b and advances the round to t + 1; the inductive hypothesis then applies with rearranged round arithmetic (Nat.add_assoc, Nat.add_comm, Nat.add_left_comm).
uses
List.cons_append,List.length_cons,Nat.add_assoc,Nat.add_comm,Nat.add_left_comminduction xs generalizing t m with | nil => simp [op1385TimedMonitorRun] | cons b xs ih => simp only [List.cons_append,op1385TimedMonitorRun,List.length_cons] simpa [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using ih (t+1) (δ t m b)
For t < u, the length of the high-walk word high t u is u - t.
By definition, high t u consists of a single true followed by u - t - 1 false entries. Its total length is therefore 1 + (u - t - 1) = u - t by linear arithmetic.
theorem high_len {t u : ℕ} (h : t < u) : (high t u).length = u-t := by simp [high]; omega
For t < u ≤ v, high t v decomposes into high t u followed by v - u false entries.
Unfolding the definition of high into a leading true and replicated false entries, the equality reduces via List.cons_append and List.replicate_add to the natural arithmetic identity (v - t - 1) = (u - t - 1) + (v - u), which holds because t < u ≤ v.
uses
List.cons_append,List.replicate_addsimp only [high,List.cons_append,← List.replicate_add] have : v-t-1 = u-t-1+(v-u) := by omega rw [this]
For any 2-coloring col of pairs of natural numbers with values in a finite set K, there is a strictly increasing sequence T and a monochromatic color c such that col (T i) (T j) = c for all i < j.
We define a coloring on 2-element subsets of ℕ by coloring each pair {x, y} with x < y according to col x y. By the infinite Ramsey theorem for graphs (Cslib.infinite_graph_ramsey), there exists an infinite monochromatic subset s ⊆ ℕ with color c. Enumerating s in strictly increasing order via the order isomorphism Nat.Subtype.orderIsoOfNat yields the required sequence T.
uses
Cslib.infinite_graph_ramsey,Finset.card_pair,Finset.coe_insert,Finset.coe_singleton,Set.mem_insert_iff,Set.mem_singleton_iffclassical let clr (e : Finset ℕ) := if h : e.Nonempty then col (e.min' h) (e.max' h) else col 0 0 obtain ⟨c,s,hs,hm⟩ := Cslib.infinite_graph_ramsey clr letI := hs.to_subtype let T (i : ℕ) : ℕ := (Nat.Subtype.orderIsoOfNat s i).val have ht : StrictMono T := fun _ _ h => (Nat.Subtype.orderIsoOfNat s).strictMono h refine ⟨T,c,ht,?_⟩ intro i j hij have h := ht hij have hv (n : ℕ) : T n ∈ s := (Nat.Subtype.orderIsoOfNat s n).property have he := hm {T i,T j} (Finset.card_pair h.ne) (by intro z hz simp only [Finset.coe_insert,Finset.coe_singleton,Set.mem_insert_iff,Set.mem_singleton_iff] at hz rcases hz with rfl|rfl · exact hv i · exact hv j) simpa [clr,Finset.min'_pair,Finset.max'_pair,min_eq_left h.le,max_eq_right h.le] using he
For a strictly increasing sequence T, the block word blocks T a k has length T(a + k) - T(a).
By induction on k. The base case k = 0 is empty. For the inductive step k + 1, blocks T a (k + 1) is blocks T a k ++ high (T (a + k)) (T (a + k + 1)). By List.length_append, the inductive hypothesis, and high_len, its length is (T (a + k) - T a) + (T (a + k + 1) - T (a + k)), which telescopes to T (a + k + 1) - T a because T is monotone.
uses
List.length_append,Nat.lt_succ_selfinduction k with | zero => simp [blocks] | succ k ih => rw [blocks,List.length_append,ih,high_len (ht (Nat.lt_succ_self _))] have h₁ : T a ≤ T (a+k) := ht.monotone (by omega) have h₂ : T (a+k) ≤ T (a+k+1) := ht.monotone (by omega) change T (a+k)-T a + (T (a+k+1)-T (a+k)) = T (a+k+1)-T a omega
Running blocks T a k on state m from round T(a) yields f^[k](m), provided every single block high (T i) (T (i + 1)) acts by f.
By induction on k. The base case k = 0 is trivial. For k + 1, Op1385Monitor.append decomposes the run across blocks T a k and high (T (a + k)) (T (a + k + 1)). The first part arrives at f^[k](m) at round T(a + k) using blocks_len and Nat.le_add_right, and the final high block applies f, giving f(f^[k](m)) = f^[k + 1](m) by Function.iterate_succ_apply'.
uses
Nat.le_add_right,Function.iterate_succ_apply'induction k with | zero => rfl | succ k ih => rw [blocks,append,blocks_len ht,ih] have h : T a + (T (a+k)-T a) = T (a+k) := by have := ht.monotone (Nat.le_add_right a k) omega rw [h,hf,Function.iterate_succ_apply']
There exists a strictly increasing sequence of rounds T and state transformations L, H : M → M such that for all i < j, all low walks from T(i) to T(j) induce L, and the high walk pattern from T(i) to T(j) induces H.
We color each pair of rounds t < u by the pair of monitor state transformations (L_{t,u}, H_{t,u}) ∈ (M → M) × (M → M), where L_{t,u} is the update from running u - t consecutive low steps (all false), and H_{t,u} is the update from running the high walk pattern (one true followed by u - t - 1 false steps). Because M is finite, the set of all pairs of endofunctions on M is finite. By the infinite Ramsey theorem for pairs (Op1385Monitor.homogeneous), there is a strictly increasing sequence T : ℕ → ℕ and a monochromatic color c = (L, H) such that every pair i < j has its low transition equal to L (via Prod.fst and congrFun) and its high transition equal to H (via Prod.snd and congrFun).
uses
Op1385Monitor.homogeneous,congrFun,congrArg,Prod.fst,Prod.sndclassical let col (t u : ℕ) : (M → M) × (M → M) := (fun m => op1385TimedMonitorRun δ t m (List.replicate (u-t) false), fun m => op1385TimedMonitorRun δ t m (Op1385Monitor.high t u)) obtain ⟨T,c,ht,hc⟩ := Op1385Monitor.homogeneous col let L := c.1 let H := c.2 have low (i j : ℕ) (h : i < j) (m : M) : op1385TimedMonitorRun δ (T i) m (List.replicate (T j - T i) false) = L m := congrFun (congrArg Prod.fst (hc i j h)) m have high (i j : ℕ) (h : i < j) (m : M) : op1385TimedMonitorRun δ (T i) m (Op1385Monitor.high (T i) (T j)) = H m := congrFun (congrArg Prod.snd (hc i j h)) m
The low transformation L fixes every state in the image of H: for all m ∈ M, L(H(m)) = H(m).
Consider the three cut times T(0) < T(1) < T(2). By Op1385Monitor.high_ext, the high walk pattern on [T(0), T(2)) decomposes into the high walk pattern on [T(0), T(1)) concatenated with all low walks on [T(1), T(2)). By the composition property of monitor runs (Op1385Monitor.append), executing this concatenation on a state m first applies H (from T(0) to T(1)) and then applies L to the result (from T(1) to T(2)), giving L(H(m)). But the entire run on [T(0), T(2)) is also a high walk on an edge of the Ramsey sequence, so its effect on m is H(m). Equating the two yields L(H(m)) = H(m).
uses
Op1385Monitor.high_ext,Op1385Monitor.append,Op1385Monitor.high_lenhave absorb (m : M) : L (H m) = H m := by have h₀ := ht (show 0 < 1 by decide) have h₁ := ht (show 1 < 2 by decide) have h := high 0 2 (by decide) m rw [Op1385Monitor.high_ext h₀ h₁.le,Op1385Monitor.append,Op1385Monitor.high_len h₀, show T 0 + (T 1 - T 0) = T 1 by omega,high 0 1 (by decide),low 1 2 (by decide)] at h exact h
There exist an offset index a, a period d > 0, and a reachable state m ∈ M such that H^[d](m) = m and L(m) = m.
Let start be the state reached from init after T(0) low steps. Consider the sequence of states x(n) = H^[n+1](start) in M. Since M is finite, by the pigeonhole principle (Finite.exists_ne_map_eq_of_infinite), there exist distinct indices i < j such that x(i) = x(j). Setting a = i + 1, d = j - i > 0, and m = x(i) = H^[a](start), the iterates satisfy H^[d](m) = H^[d + i + 1](start) = x(j) = x(i) = m (Function.iterate_add_apply), making m periodic under H with period d. Furthermore, because m = H(H^[i](start)) is in the range of H, the absorption property L(H(·)) = H(·) gives L(m) = m (Function.iterate_succ_apply'), so m is also a fixed point of L.
uses
Finite.exists_ne_map_eq_of_infinite,lt_or_gt_of_ne,Function.iterate_add_apply,Function.iterate_succ_apply'let start := op1385TimedMonitorRun δ 0 init (List.replicate (T 0) false) let x (n : ℕ) := H^[n+1] start obtain ⟨i,j,hij,he⟩ : ∃ i j, i < j ∧ x i = x j := by obtain ⟨i,j,hn,he⟩ := Finite.exists_ne_map_eq_of_infinite x rcases lt_or_gt_of_ne hn with h|h · exact ⟨i,j,h,he⟩ · exact ⟨j,i,h,he.symm⟩ let a := i+1 let d := j-i let m := x i have hd : 0 < d := by dsimp [d]; omega have hmH : H^[d] m = m := by change H^[d] (H^[i+1] start) = x i rw [← Function.iterate_add_apply,show d+(i+1) = j+1 by dsimp [d]; omega] exact he.symm have hmL : L m = m := by change L (H^[i+1] start) = H^[i+1] start rw [Function.iterate_succ_apply'] exact absorb _
Concatenating k block intervals acts by the k-th iterate H^[k], and the arithmetic progression of indices idx(n) = a + n * d is strictly increasing.
By Op1385Monitor.blocks_effect, concatenating k consecutive intervals of the form high (T l) (T (l+1)) applies the k-th iterate H^[k] to the state at T(a). Defining idx(n) = a + n * d, we have idx(n+1) = idx(n) + d (Nat.add_mul, Nat.add_assoc). Because d > 0, idx is strictly increasing by strictMono_nat_of_lt_succ.
uses
Op1385Monitor.blocks_effect,Nat.lt_succ_self,Nat.add_mul,Nat.add_assoc,strictMono_nat_of_lt_succhave eff := Op1385Monitor.blocks_effect ht δ H (fun n => high n (n+1) (Nat.lt_succ_self n)) let idx (n : ℕ) := a+n*d have idxstep (n : ℕ) : idx (n+1) = idx n+d := by simp [idx,Nat.add_mul,Nat.add_assoc] have hidx : StrictMono idx := strictMono_nat_of_lt_succ (fun n => by rw [idxstep]; omega)
The cut times s = T ∘ idx are strictly increasing, and there is a prefix word pre of length s(0) leading from init at time 0 to m.
We set the cut times s = T ∘ idx, which is strictly increasing as the composition of strictly monotone functions. The prefix word pre is formed by T(0) low steps followed by blocks T 0 a. By Op1385Monitor.blocks_len, its length is T(0) + (T(a) - T(0)) = T(a) = s(0). Running pre from time 0 starting at init takes init to start after the initial T(0) low steps, and then blocks T 0 a carries start to H^[a](start) = m by Op1385Monitor.blocks_effect, reaching m at round s(0).
uses
Op1385Monitor.blocks_len,Nat.zero_le,Op1385Monitor.append,List.length_replicate,Nat.zero_addlet pre := List.replicate (T 0) false ++ Op1385Monitor.blocks T 0 a refine ⟨T ∘ idx,m,pre,ht.comp hidx,?_,?_,?_⟩ · have hh := ht.monotone (Nat.zero_le a) simp [pre,Op1385Monitor.blocks_len ht,idx,Function.comp_def] <;> omega · simp only [pre,Op1385Monitor.append,List.length_replicate,Nat.zero_add] exact eff 0 a start
For every round block n, there is a word w of length s(n+1) - s(n) containing at least one high step such that both w and the all-low word of that length loop m back to m.
For each block n, let w = blocks T (idx n) d. By Op1385Monitor.blocks_len, its length is T(idx(n) + d) - T(idx n) = s(n+1) - s(n). Because d > 0, d is a successor (Nat.exists_eq_succ_of_ne_zero), so w contains at least one high walk, which starts with true. Running w from round s(n) starting at m applies H^[d](m) = m, returning to m. Running the all-low walk of the same length corresponds to the edge (idx(n), idx(n+1)) in the Ramsey sequence, which applies L(m) = m. Thus both the high-containing word w and the all-low word loop m to itself.
uses
Op1385Monitor.blocks_len,Nat.exists_eq_succ_of_ne_zero,Nat.lt_succ_self· intro n let w := Op1385Monitor.blocks T (idx n) d have hlen : w.length = T (idx (n+1)) - T (idx n) := by rw [idxstep]; exact Op1385Monitor.blocks_len ht _ _ refine ⟨w,hlen,?_,(eff _ _ m).trans hmH,?_⟩ · obtain ⟨k,hk⟩ := Nat.exists_eq_succ_of_ne_zero hd.ne' simp [w,hk,Op1385Monitor.blocks,Op1385Monitor.high] · rw [hlen] exact (low _ _ (hidx (Nat.lt_succ_self n)) m).trans hmL
Cslib.infinite_graph_ramsey- For any coloring of 2-element subsets of ℕ with values in a finite set K, there is an infinite subset s ⊆ ℕ whose 2-element subsets all receive the same color.
Finite.exists_ne_map_eq_of_infinite- Any function from an infinite domain to a finite codomain maps at least two distinct elements to the same value (the pigeonhole principle).
Finset.card_pair- A two-element set {a, b} with a ≠ b has cardinality 2.
Finset.coe_insert- The coercion of inserting an element into a finset equals set insertion: ↑(insert a s) = insert a ↑s.
Finset.coe_singleton- The coercion of a singleton finset {a} to a set equals {a}.
Function.iterate_add_apply- Iterating a function m + n times equals iterating it m times on the result of iterating it n times: f^[m + n](x) = f^[m](f^[n](x)).
Function.iterate_succ_apply'- Iterating a function n + 1 times equals applying f to the n-th iterate: f^[n + 1](x) = f(f^[n](x)).
List.cons_append- Prepending an element to xs before appending ys equals prepending it to xs ++ ys: (a :: xs) ++ ys = a :: (xs ++ ys).
List.length_append- The length of the concatenation of two lists is the sum of their lengths: (as ++ bs).length = as.length + bs.length.
List.length_cons- The length of a list with an element prepended is one more than its original length: (a :: as).length = as.length + 1.
List.length_replicate- A list formed by replicating an element n times has length n.
List.replicate_add- Replicating an element m + n times decomposes into replicating it m times concatenated with replicating it n times.
Nat.add_assoc- Addition of natural numbers is associative: n + m + k = n + (m + k).
Nat.add_comm- Addition of natural numbers is commutative: n + m = m + n.
Nat.add_left_comm- Addition of natural numbers satisfies n + (m + k) = m + (n + k).
Nat.add_mul- Multiplication of natural numbers distributes over addition from the right: (n + m) * k = n * k + m * k.
Nat.exists_eq_succ_of_ne_zero- Any non-zero natural number is the successor of some natural number.
Nat.le_add_right- Any natural number is less than or equal to its sum with another: n ≤ n + k.
Nat.lt_succ_self- Every natural number n is strictly less than its successor n + 1.
Nat.zero_add- Adding zero to any natural number leaves it unchanged: 0 + n = n.
Nat.zero_le- Zero is less than or equal to any natural number: 0 ≤ n.
Op1385Monitor.append- Running a monitor on the concatenation xs ++ ys equals running ys starting from the round and state reached after xs.
Op1385Monitor.blocks_effect- If running the high walk on each interval [T(i), T(i + 1)) acts by a fixed transformation f, then running k consecutive blocks from T(a) acts by the k-th iterate f^[k].
Op1385Monitor.blocks_len- The concatenated word of k blocks starting at index a in a strictly increasing sequence T has length T(a + k) - T(a).
Op1385Monitor.high_ext- The high walk on [t, v) decomposes as the high walk on [t, u) concatenated with all low walks on [u, v) whenever t < u ≤ v.
Op1385Monitor.high_len- The length of the high walk on [t, u) is u - t whenever t < u.
Op1385Monitor.homogeneous- For any 2-coloring of pairs of natural numbers with values in a finite set K, there is a strictly increasing sequence of indices on which the coloring is constant.
Prod.fst- The first component of an ordered pair.
Prod.snd- The second component of an ordered pair.
Set.mem_insert_iff- An element x belongs to insert a s if and only if x = a or x ∈ s.
Set.mem_singleton_iff- An element a belongs to {b} if and only if a = b.
congrArg- Applying a function to equal arguments yields equal results: if a = b then f(a) = f(b).
congrFun- Equal functions take equal values when evaluated at any argument: if f = g then f(a) = g(a).
lt_or_gt_of_ne- Two distinct elements in a linear order satisfy either a < b or b < a.
strictMono_nat_of_lt_succ- A sequence of natural numbers is strictly monotone if each term is strictly less than its successor.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option maxHeartbeats 600000/-- Run a memory update at successive public rounds, with the Boolean specifying which of twosame-word returning walks was taken in that round. -/def op1385TimedMonitorRun {M : Type} (δ : ℕ → M → Bool → M) (t : ℕ) (m : M) : List Bool → M | [] => m | b :: bs => op1385TimedMonitorRun δ (t+1) (δ t m b) bsnamespace Op1385Monitortheorem append {M : Type} (δ : ℕ → M → Bool → M) (t : ℕ) (m : M) (xs ys : List Bool) : op1385TimedMonitorRun δ t m (xs ++ ys) = op1385TimedMonitorRun δ (t+xs.length) (op1385TimedMonitorRun δ t m xs) ys := by induction xs generalizing t m with | nil => simp [op1385TimedMonitorRun] | cons b xs ih => simp only [List.cons_append,op1385TimedMonitorRun,List.length_cons] simpa [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using ih (t+1) (δ t m b)def high (t u : ℕ) := true :: List.replicate (u-t-1) falsetheorem high_len {t u : ℕ} (h : t < u) : (high t u).length = u-t := by simp [high]; omegatheorem high_ext {t u v : ℕ} (h : t < u) (k : u ≤ v) : high t v = high t u ++ List.replicate (v-u) false := by simp only [high,List.cons_append,← List.replicate_add] have : v-t-1 = u-t-1+(v-u) := by omega rw [this]theorem homogeneous {K : Type} [Finite K] (col : ℕ → ℕ → K) : ∃ (T : ℕ → ℕ) (c : K), StrictMono T ∧ ∀ i j, i < j → col (T i) (T j) = c := by classical let clr (e : Finset ℕ) := if h : e.Nonempty then col (e.min' h) (e.max' h) else col 0 0 obtain ⟨c,s,hs,hm⟩ := Cslib.infinite_graph_ramsey clr letI := hs.to_subtype let T (i : ℕ) : ℕ := (Nat.Subtype.orderIsoOfNat s i).val have ht : StrictMono T := fun _ _ h => (Nat.Subtype.orderIsoOfNat s).strictMono h refine ⟨T,c,ht,?_⟩ intro i j hij have h := ht hij have hv (n : ℕ) : T n ∈ s := (Nat.Subtype.orderIsoOfNat s n).property have he := hm {T i,T j} (Finset.card_pair h.ne) (by intro z hz simp only [Finset.coe_insert,Finset.coe_singleton,Set.mem_insert_iff,Set.mem_singleton_iff] at hz rcases hz with rfl|rfl · exact hv i · exact hv j) simpa [clr,Finset.min'_pair,Finset.max'_pair,min_eq_left h.le,max_eq_right h.le] using hedef blocks (T : ℕ → ℕ) (a : ℕ) : ℕ → List Bool | 0 => [] | k+1 => blocks T a k ++ high (T (a+k)) (T (a+k+1))theorem blocks_len {T : ℕ → ℕ} (ht : StrictMono T) (a k : ℕ) : (blocks T a k).length = T (a+k)-T a := by induction k with | zero => simp [blocks] | succ k ih => rw [blocks,List.length_append,ih,high_len (ht (Nat.lt_succ_self _))] have h₁ : T a ≤ T (a+k) := ht.monotone (by omega) have h₂ : T (a+k) ≤ T (a+k+1) := ht.monotone (by omega) change T (a+k)-T a + (T (a+k+1)-T (a+k)) = T (a+k+1)-T a omegatheorem blocks_effect {M : Type} {T : ℕ → ℕ} (ht : StrictMono T) (δ : ℕ → M → Bool → M) (f : M → M) (hf : ∀ i m, op1385TimedMonitorRun δ (T i) m (high (T i) (T (i+1))) = f m) (a k : ℕ) (m : M) : op1385TimedMonitorRun δ (T a) m (blocks T a k) = f^[k] m := by induction k with | zero => rfl | succ k ih => rw [blocks,append,blocks_len ht,ih] have h : T a + (T (a+k)-T a) = T (a+k) := by have := ht.monotone (Nat.le_add_right a k) omega rw [h,hf,Function.iterate_succ_apply']end Op1385Monitortheorem prioritized_borel_time_dependent_monitor_preserves_ambiguous_loops {M : Type} [Finite M] (δ : ℕ → M → Bool → M) (init : M) : ∃ (s : ℕ → ℕ) (m : M) (pre : List Bool), StrictMono s ∧ pre.length = s 0 ∧ op1385TimedMonitorRun δ 0 init pre = m ∧ ∀ n, ∃ w : List Bool, w.length = s (n+1)-s n ∧ true ∈ w ∧ op1385TimedMonitorRun δ (s n) m w = m ∧ op1385TimedMonitorRun δ (s n) m (List.replicate w.length false) = m := by classical let col (t u : ℕ) : (M → M) × (M → M) := (fun m => op1385TimedMonitorRun δ t m (List.replicate (u-t) false), fun m => op1385TimedMonitorRun δ t m (Op1385Monitor.high t u)) obtain ⟨T,c,ht,hc⟩ := Op1385Monitor.homogeneous col let L := c.1 let H := c.2 have low (i j : ℕ) (h : i < j) (m : M) : op1385TimedMonitorRun δ (T i) m (List.replicate (T j - T i) false) = L m := congrFun (congrArg Prod.fst (hc i j h)) m have high (i j : ℕ) (h : i < j) (m : M) : op1385TimedMonitorRun δ (T i) m (Op1385Monitor.high (T i) (T j)) = H m := congrFun (congrArg Prod.snd (hc i j h)) m have absorb (m : M) : L (H m) = H m := by have h₀ := ht (show 0 < 1 by decide) have h₁ := ht (show 1 < 2 by decide) have h := high 0 2 (by decide) m rw [Op1385Monitor.high_ext h₀ h₁.le,Op1385Monitor.append,Op1385Monitor.high_len h₀, show T 0 + (T 1 - T 0) = T 1 by omega,high 0 1 (by decide),low 1 2 (by decide)] at h exact h let start := op1385TimedMonitorRun δ 0 init (List.replicate (T 0) false) let x (n : ℕ) := H^[n+1] start obtain ⟨i,j,hij,he⟩ : ∃ i j, i < j ∧ x i = x j := by obtain ⟨i,j,hn,he⟩ := Finite.exists_ne_map_eq_of_infinite x rcases lt_or_gt_of_ne hn with h|h · exact ⟨i,j,h,he⟩ · exact ⟨j,i,h,he.symm⟩ let a := i+1 let d := j-i let m := x i have hd : 0 < d := by dsimp [d]; omega have hmH : H^[d] m = m := by change H^[d] (H^[i+1] start) = x i rw [← Function.iterate_add_apply,show d+(i+1) = j+1 by dsimp [d]; omega] exact he.symm have hmL : L m = m := by change L (H^[i+1] start) = H^[i+1] start rw [Function.iterate_succ_apply'] exact absorb _ have eff := Op1385Monitor.blocks_effect ht δ H (fun n => high n (n+1) (Nat.lt_succ_self n)) let idx (n : ℕ) := a+n*d have idxstep (n : ℕ) : idx (n+1) = idx n+d := by simp [idx,Nat.add_mul,Nat.add_assoc] have hidx : StrictMono idx := strictMono_nat_of_lt_succ (fun n => by rw [idxstep]; omega) let pre := List.replicate (T 0) false ++ Op1385Monitor.blocks T 0 a refine ⟨T ∘ idx,m,pre,ht.comp hidx,?_,?_,?_⟩ · have hh := ht.monotone (Nat.zero_le a) simp [pre,Op1385Monitor.blocks_len ht,idx,Function.comp_def] <;> omega · simp only [pre,Op1385Monitor.append,List.length_replicate,Nat.zero_add] exact eff 0 a start · intro n let w := Op1385Monitor.blocks T (idx n) d have hlen : w.length = T (idx (n+1)) - T (idx n) := by rw [idxstep]; exact Op1385Monitor.blocks_len ht _ _ refine ⟨w,hlen,?_,(eff _ _ m).trans hmH,?_⟩ · obtain ⟨k,hk⟩ := Nat.exists_eq_succ_of_ne_zero hd.ne' simp [w,hk,Op1385Monitor.blocks,Op1385Monitor.high] · rw [hlen] exact (low _ _ (hidx (Nat.lt_succ_self n)) m).trans hmL