OAI/Computability/Superstring/Counts.lean
81 declarations, 0 contain sorry, 0 declared as axioms
- def
OAI.Superstring.Counts.Occursline 13Source documentation
A substring occurrence retains its starting position, so overlapping occurrences are counted separately.
def Occurs (T s : List α) (x : ℕ) : Prop := …
- instance
OAI.Superstring.Counts.(instance at line 16)line 16 - abbrev
OAI.Superstring.Counts.Occurrenceline 19 - def
OAI.Superstring.Counts.numberline 21 - theorem
OAI.Superstring.Counts.Occurs.atline 23 - theorem
OAI.Superstring.Counts.Occurs.reflline 26 - theorem
OAI.Superstring.Counts.Occurs.transline 29 - theorem
OAI.Superstring.Counts.Occurs.infixline 37 - theorem
OAI.Superstring.Counts.Occurs.uniqueline 48 - def
OAI.Superstring.Counts.Blockline 58Source documentation
The inner occurrence is strictly inside the two single-letter mismatches.
def Block (A : ℤ → α) (s r : List α) (j : ℕ) : Prop := …
- instance
OAI.Superstring.Counts.(instance at line 65)line 65 - abbrev
OAI.Superstring.Counts.BlockPositionline 68 - def
OAI.Superstring.Counts.coefficientline 71 - def
OAI.Superstring.Counts.blockingline 74 - theorem
OAI.Superstring.Counts.Block.length_posline 81 - theorem
OAI.Superstring.Counts.Block.leftline 83 - theorem
OAI.Superstring.Counts.Block.rightline 92 - theorem
OAI.Superstring.Counts.Block.insideline 104 - theorem
OAI.Superstring.Counts.Block.boundaries_uniqueline 119 - abbrev
OAI.Superstring.Counts.BlockWitnessline 150Source documentation
A recorded bracketing word occurrence, and a counted placement inside it.
abbrev BlockWitness (V : Finset (List α)) (T : List α) (A : ℤ → α) (s : List α) := …
- def
OAI.Superstring.Counts.blockedOccurrenceline 154Source documentation
The blocked-occurrence map.
def blockedOccurrence (V : Finset (List α)) (T : List α) (A : ℤ → α) (s : List α) (w : BlockWitness V T A s) : Occurrence T s := …Mentions: OAI.Superstring.Counts.BlockWitness, OAI.Superstring.Counts.Occurrence
- theorem
OAI.Superstring.Counts.blockedOccurrence_injectiveline 159 - theorem
OAI.Superstring.Counts.card_blockWitnessline 176 - theorem
OAI.Superstring.Counts.blocking_le_numberline 186 - theorem
OAI.Superstring.Counts.coefficient_pos_lengthline 193Source documentation
Positivity of a coefficient forces the strict length dependency used in both the descending recursion and its occurrence-bound induction.
theorem coefficient_pos_length [DecidableEq α] {A : ℤ → α} {s r : List α} (h : 0 < coefficient A s r) : s.length + 2 ≤ r.length := by …Mentions: OAI.Superstring.Counts.coefficient
- def
OAI.Superstring.Counts.Matchesline 201Source documentation
Agreement with a template at origin zero, as in every count rule.
def Matches (A : ℤ → α) (s : List α) : Prop := …
- theorem
OAI.Superstring.Counts.periodic_nat_addline 204 - theorem
OAI.Superstring.Counts.periodic_nat_subline 208 - theorem
OAI.Superstring.Counts.period_prefixline 213Source documentation
All period-spaced prefixes of a rule's longer word are genuine occurrences.
theorem period_prefix {A : ℤ → α} {p t : ℕ} {v w : List α} (per : Function.Periodic A (p : ℤ)) (hv : Matches A v) (hw : Matches A w) (hlen : t * p + w.length ≤ v.length) : Occurs v w (t * p) := by …Mentions: OAI.Superstring.Counts.Matches, OAI.Superstring.Counts.Occurs
- theorem
OAI.Superstring.Counts.Block.shiftline 226Source documentation
A bracketing placement of the long word generates every period-spaced placement of its short prefix in the SAME bracketing word.
theorem Block.shift {A : ℤ → α} {p t j : ℕ} {v w r : List α} (h : Block A v r j) (per : Function.Periodic A (p : ℤ)) (hv : Matches A v) (hw : Matches A w) (hlen : t * p + w.length ≤ v.length) : Block A w r (j + t * p) := by …Mentions: OAI.Superstring.Counts.Block, OAI.Superstring.Counts.Matches
- theorem
OAI.Superstring.Counts.coefficient_amplificationline 246Source documentation
Coefficient amplification for occurrence counts.
theorem coefficient_amplification [DecidableEq α] {A : ℤ → α} {p k : ℕ} {v w r : List α} (hp : 0 < p) (per : Function.Periodic A (p : ℤ)) (hv : Matches A v) (hw : Matches A w) (hlen : w.length + k * p = v.length) (hb : 0 < coefficient A v r) : k + 1 ≤ coefficient A w r := by …Mentions: OAI.Superstring.Counts.Matches, OAI.Superstring.Counts.coefficient
- theorem
OAI.Superstring.Counts.Occurs.factorline 266Source documentation
Restrict an occurrence through another containing occurrence.
theorem Occurs.factor {T r v : List α} {x y : ℕ} (hr : Occurs T r y) (hv : Occurs T v x) (hyx : y ≤ x) (hend : x + v.length ≤ y + r.length) : Occurs r v (x - y) := by …Mentions: OAI.Superstring.Counts.Occurs
- theorem
OAI.Superstring.Counts.Block.expandline 280Source documentation
Retarget a block by a whole number of template periods, when the enlarged inner occurrence still lies strictly between the same mismatch letters.
theorem Block.expand {A : ℤ → α} {p t j j' : ℕ} {v w r : List α} (h : Block A w r j) (per : Function.Periodic A (p : ℤ)) (hj : j = j' + t * p) (hj' : 1 ≤ j') (hlen : j' + v.length < r.length) (hr : Occurs r v j') : Block A v r j' := by …Mentions: OAI.Superstring.Counts.Block, OAI.Superstring.Counts.Occurs
- theorem
OAI.Superstring.Counts.Block.encloses_matchingline 299Source documentation
A blocking pair around a period-spaced short occurrence inside a matching long word must lie outside that entire long occurrence, and blocks it too.
theorem Block.encloses_matching {A : ℤ → α} {T v w r : List α} {p t x y j : ℕ} (h : Block A w r j) (hr : Occurs T r y) (hv : Occurs T v x) (hmatch : Matches A v) (per : Function.Periodic A (p : ℤ)) (hlen : t * p + w.length ≤ v.length) (hpos : y + j = x + t * p) : ∃ j', Block A v r j' ∧ y + j' = x := by …Mentions: OAI.Superstring.Counts.Block, OAI.Superstring.Counts.Occurs, OAI.Superstring.Counts.Matches
- def
OAI.Superstring.Counts.periodOccurrenceline 336Source documentation
A period-spaced suboccurrence of a fixed long occurrence.
def periodOccurrence {A : ℤ → α} {T v w : List α} {p k : ℕ} (per : Function.Periodic A (p : ℤ)) (hv : Matches A v) (hw : Matches A w) (hlen : w.length + k * p = v.length) (o : Occurrence T v) (t : Fin (k + 1)) : Occurrence T w := …Mentions: OAI.Superstring.Counts.Matches, OAI.Superstring.Counts.Occurrence
- theorem
OAI.Superstring.Counts.periodOccurrence_injectiveline 346 - def
OAI.Superstring.Counts.Unblockedline 358 - theorem
OAI.Superstring.Counts.Unblocked.period_prefixline 361 - theorem
OAI.Superstring.Counts.unblocked_count_growthline 382 - theorem
OAI.Superstring.Counts.blocking_monoline 405Source documentation
The functional depends monotonically only on words STRICTLY longer than its inner word, although the triggered count operator itself need not be monotone.
theorem blocking_mono [DecidableEq α] {V : Finset (List α)} {A : ℤ → α} {s : List α} {m n : List α → ℕ} (hmn : ∀ r ∈ V, s.length < r.length → m r ≤ n r) : blocking V A s m ≤ blocking V A s n := by …Mentions: OAI.Superstring.Counts.blocking
- theorem
OAI.Superstring.Counts.sum_increaseline 417Source documentation
Retaining the increase at one summand while all other summands increase.
theorem sum_increase {ι : Type} [DecidableEq ι] (I : Finset ι) (a b : ι → ℕ) (h : ∀ i ∈ I, a i ≤ b i) {r : ι} (hr : r ∈ I) : (∑ i ∈ I, a i) + (b r - a r) ≤ ∑ i ∈ I, b i := by … - theorem
OAI.Superstring.Counts.period_rule_lower_boundline 428 - theorem
OAI.Superstring.Counts.exists_occurs_of_infixline 478 - theorem
OAI.Superstring.Counts.number_pos_of_infixline 486 - theorem
OAI.Superstring.Counts.Occurs.cons_tailline 492 - theorem
OAI.Superstring.Counts.Occurs.append_initline 499 - theorem
OAI.Superstring.Counts.left_extension_numberline 508Source documentation
Disjointness of preceding-letter occurrence classes gives the first extension lower bound in the count recursion.
theorem left_extension_number [DecidableEq α] (alphabet : Finset α) (T w : List α) : (∑ c ∈ alphabet, number T (c :: w)) ≤ number T w := by …Mentions: OAI.Superstring.Counts.number
- theorem
OAI.Superstring.Counts.right_extension_numberline 531Source documentation
The analogous following-letter occurrence classes are disjoint too.
theorem right_extension_number [DecidableEq α] (alphabet : Finset α) (T w : List α) : (∑ c ∈ alphabet, number T (w ++ [c])) ≤ number T w := by …Mentions: OAI.Superstring.Counts.number
- structure
OAI.Superstring.Counts.Dataline 555Source documentation
Finite data of the preprocessed instance; geometric hypotheses are proved for the actual input construction below, not hidden in this record.
structure Data (α : Type) where …
- def
OAI.Superstring.Counts.finiteTextline 562Source documentation
The unique period-p text determined by the first p letters of v. Fallback values are never used in a valid rule, since there 0 < p < length v.
def finiteText [Inhabited α] (v : List α) (p : ℕ) (x : ℤ) : α := …
- theorem
OAI.Superstring.Counts.finiteText_periodicline 565 - instance
OAI.Superstring.Counts.(instance at line 570)line 570 - theorem
OAI.Superstring.Counts.blocking_congrline 574Source documentation
Equality of the longer counts preserves a blocking functional.
theorem blocking_congr [DecidableEq α] {V : Finset (List α)} {A : ℤ → α} {s : List α} {m n : List α → ℕ} (hmn : ∀ r ∈ V, s.length < r.length → m r = n r) : blocking V A s m = blocking V A s n := by …Mentions: OAI.Superstring.Counts.blocking
- def
OAI.Superstring.Counts.Data.ruleline 590 - def
OAI.Superstring.Counts.Data.rulesline 598Source documentation
Finite enumeration of ALL rules; no least-period restriction is imposed.
def rules (D : Data α) (m : List α → ℕ) (w : List α) : ℕ := …
Mentions: OAI.Superstring.Counts.Data
- def
OAI.Superstring.Counts.Data.leftline 602 - def
OAI.Superstring.Counts.Data.rightline 605 - def
OAI.Superstring.Counts.Data.stepline 609 - def
OAI.Superstring.Counts.Data.stageline 616Source documentation
Parallel triangular evaluation; the stabilization proof below shows that this computes the exact descending recursion, rather than a different fixed point.
def stage (D : Data α) : ℕ → List α → ℕ | 0 => fun _ => 0 | n + 1 => D.step (D.stage n)
Mentions: OAI.Superstring.Counts.Data
- def
OAI.Superstring.Counts.Data.depthline 620 - def
OAI.Superstring.Counts.Data.countline 622 - theorem
OAI.Superstring.Counts.Data.step_le_numberline 624 - theorem
OAI.Superstring.Counts.Data.stage_le_numberline 668Source documentation
Every intermediate computational stage, not only the final counts, is bounded by the occurrence counts of EVERY common superstring.
theorem stage_le_number (D : Data α) (T : List α) (hinput : ∀ w ∈ D.required, w <:+: T) (n : ℕ) (w : List α) : D.stage n w ≤ number T w := by …Mentions: OAI.Superstring.Counts.Data, OAI.Superstring.Counts.number
- theorem
OAI.Superstring.Counts.Data.rule_congrline 676Source documentation
A rule value depends only on strictly longer words.
theorem rule_congr (D : Data α) {m n : List α → ℕ} {w v : List α} (p k : ℕ) (hvV : v ∈ D.vertices) (hmn : ∀ r ∈ D.vertices, w.length < r.length → m r = n r) : D.rule m w v p k = D.rule n w v p k := by …Mentions: OAI.Superstring.Counts.Data
- theorem
OAI.Superstring.Counts.Data.step_congrline 696Source documentation
Triangularity of the complete finite operator.
theorem step_congr (D : Data α) {m n : List α → ℕ} {w : List α} (hmn : ∀ r ∈ D.vertices, w.length < r.length → m r = n r) : D.step m w = D.step n w := by …Mentions: OAI.Superstring.Counts.Data
- theorem
OAI.Superstring.Counts.Data.stage_stableline 722Source documentation
After n stages every word less than n levels from the top has stabilized.
theorem stage_stable (D : Data α) (n : ℕ) (w : List α) (hdepth : D.depth < w.length + n) : D.stage (n + 1) w = D.stage n w := by …Mentions: OAI.Superstring.Counts.Data
- theorem
OAI.Superstring.Counts.Data.count_fixedline 738Source documentation
The actual counts satisfy exactly the minimal-bound recursion.
theorem count_fixed (D : Data α) (w : List α) : D.step D.count w = D.count w := by …
Mentions: OAI.Superstring.Counts.Data
- theorem
OAI.Superstring.Counts.Data.count_le_numberline 742 - theorem
OAI.Superstring.Counts.Data.count_zeroline 746 - theorem
OAI.Superstring.Counts.Data.required_le_countline 757 - theorem
OAI.Superstring.Counts.Data.left_le_countline 764 - theorem
OAI.Superstring.Counts.Data.right_le_countline 770 - theorem
OAI.Superstring.Counts.Data.left_countline 776 - theorem
OAI.Superstring.Counts.Data.right_countline 784 - theorem
OAI.Superstring.Counts.Data.rule_le_countline 792 - theorem
OAI.Superstring.Counts.finiteText_eqline 813Source documentation
The finite rule representative is the original two-sided text, not merely its forward restriction.
theorem finiteText_eq [Inhabited α] {A : ℤ → α} {v : List α} {p : ℕ} (hp : 0 < p) (hper : Function.Periodic A (p : ℤ)) (hm : Matches A v) (hlen : p ≤ v.length) : finiteText v p = A := by …Mentions: OAI.Superstring.Counts.Matches, OAI.Superstring.Counts.finiteText
- theorem
OAI.Superstring.Counts.Data.period_ruleline 832Source documentation
Every period rule holds for the computed counts.
theorem period_rule (D : Data α) {A : ℤ → α} {w v : List α} {p k : ℕ} (hp : 0 < p) (hk : 0 < k) (hper : Function.Periodic A (p : ℤ)) (hw : w ∈ D.vertices) (hne : w ≠ []) (hv : v ∈ D.vertices) (hmv : Matches A v) (hmw : Matches A w) (hlen : w.length + k * p = v.length) (htrigger : blocking D.vertices A v D.count < D.count v) : blocking D.vertices A w D.count + k + 1 ≤ D.count w := by …Mentions: OAI.Superstring.Counts.Data, OAI.Superstring.Counts.Matches, OAI.Superstring.Counts.blocking
- theorem
OAI.Superstring.Counts.number_le_lengthline 851Source documentation
Nonempty occurrences inject into the positions of the ambient word.
theorem number_le_length [DecidableEq α] {T s : List α} (hs : s ≠ []) : number T s ≤ T.length := by …Mentions: OAI.Superstring.Counts.number
- theorem
OAI.Superstring.Counts.singleton_number_sumline 864Source documentation
Counts of one-letter occurrences, independently of how large the alphabet of labels is, sum to at most the symbol length of the ambient word.
theorem singleton_number_sum [DecidableEq α] (C : Finset α) (T : List α) : (∑ c ∈ C, number T [c]) ≤ T.length := by …Mentions: OAI.Superstring.Counts.number
- def
OAI.Superstring.Counts.Data.weightline 887 - theorem
OAI.Superstring.Counts.Data.weight_le_lengthline 889