OAI/Computability/Superstring/Counting.lean
25 declarations, 0 contain sorry, 0 declared as axioms
- theorem
OAI.Superstring.Hierarchical.TextOccurs.occurs_wordline 11 - theorem
OAI.Superstring.Hierarchical.TextOccurs.agrees_templateline 23 - theorem
OAI.Superstring.Counts.Block.text_leftline 42 - theorem
OAI.Superstring.Counts.Block.text_rightline 48 - theorem
OAI.Superstring.Counts.Block.text_insideline 58 - theorem
OAI.Superstring.Counts.Block.text_boundaries_uniqueline 70Source documentation
Nearest-mismatch uniqueness on a bi-infinite lift; endpoints may be negative.
theorem text_boundaries_unique (h : Block A s r j) (h' : Block A s r' j') (hr : TextOccurs B r x) (hr' : TextOccurs B r' x') (he : x + j = x' + j') : x = x' ∧ r.length = r'.length := by …Mentions: OAI.Superstring.Counts.Block
- theorem
OAI.Superstring.Counts.Block.of_boundsline 102 - theorem
OAI.Superstring.Hierarchical.Layer.first_containingline 140Source documentation
The first up crossing of an occurrence end is an actual containing window.
theorem first_containing (D : Layer V B p) (hp : 0 < p) {s : List α} {t : ℤ} (hr : D.Records s t) : ∃ a : ℤ, a ≤ t ∧ D.first a ≤ t + s.length ∧ t + s.length ≤ D.last a := by …Mentions: OAI.Superstring.Hierarchical.Layer
- theorem
OAI.Superstring.Hierarchical.Layer.matching_or_blockline 160 - abbrev
OAI.Superstring.Hierarchical.Layer.BlockWitnessline 231Source documentation
A recorded complete bracketing word and one of its eligible inner placements.
abbrev BlockWitness (D : Layer V B p) (F : Finset (List α)) (A : ℤ → α) (s : List α) := …
Mentions: OAI.Superstring.Hierarchical.Layer
- def
OAI.Superstring.Hierarchical.Layer.blockedOccurrenceline 234 - theorem
OAI.Superstring.Hierarchical.Layer.blockedOccurrence_injectiveline 240Source documentation
Injectivity holds modulo one primitive turn, even when a block spans many turns.
theorem blockedOccurrence_injective (D : Layer V B p) (hp : 0 < p) (per : Function.Periodic B (p : ℤ)) (F : Finset (List α)) (A : ℤ → α) (s : List α) : Function.Injective (D.blockedOccurrence hp per F A s) := by …Mentions: OAI.Superstring.Hierarchical.Layer
- theorem
OAI.Superstring.Hierarchical.Layer.card_blockWitnessline 291Source documentation
The exact block count for one periodic layer.
theorem card_blockWitness [DecidableEq α] (D : Layer V B p) (F : Finset (List α)) (A : ℤ → α) (s : List α) : Fintype.card (D.BlockWitness F A s) = Counts.blocking F A s (fun r => Fintype.card (D.Occurrence r)) := by …Mentions: OAI.Superstring.Hierarchical.Layer, OAI.Superstring.Counts.blocking
- theorem
OAI.Superstring.Hierarchical.Layer.normalize_addline 302Source documentation
Normalization is compatible with moving to an inner occurrence.
theorem normalize_add (D : Layer V B p) (hp : 0 < p) (per : Function.Periodic B (p : ℤ)) {r s : List α} {y : ℤ} (hy : D.Records r y) {j : ℕ} (hj : Counts.Occurs r s j) : D.normalize hp per (D.records_suboccurrence (D.normalize hp per hy).property hj) = D.normalize hp per (D.records_suboccurrence hy hj) := by …Mentions: OAI.Superstring.Hierarchical.Layer, OAI.Superstring.Counts.Occurs
- theorem
OAI.Superstring.Hierarchical.Layer.matching_of_not_blockedline 319Source documentation
Unblocked occurrences have actual matching windows; no matching-window certificate is assumed in selecting an occurrence later in the algorithm.
theorem matching_of_not_blocked (D : Layer V B p) (F : Finset (List α)) (hV : V = (F : Set (List α))) (closed : SubstringClosed V) (hp : 0 < p) (per : Function.Periodic B (p : ℤ)) {A : ℤ → α} {s : List α} (hA : Counts.Matches A s) (o : D.Occurrence s) (ho : ¬ ∃ w : D.BlockWitness F A s, D.blockedOccurrence hp per F A s w = o) : ∃ a b : ℤ, a ≤ o.val.val ∧ (o.val.val : ℤ) + s.length ≤ b ∧ D.first a ≤ b ∧ b ≤ D.last a ∧ AgreeOn B (fun x => A (x - o.val.val)) a b := by …Mentions: OAI.Superstring.Hierarchical.Layer, OAI.Superstring.Hierarchical.SubstringClosed, OAI.Superstring.Counts.Matches, OAI.Superstring.Hierarchical.AgreeOn
- theorem
OAI.Superstring.Hierarchical.Layer.aligned_not_blockedline 344Source documentation
An occurrence whose full-text alignment equals the template is never blocked.
theorem aligned_not_blocked (D : Layer V B p) (hp : 0 < p) (per : Function.Periodic B (p : ℤ)) (F : Finset (List α)) {A : ℤ → α} {s : List α} (o : D.Occurrence s) (halign : ∀ x : ℤ, B (x + o.val.val) = A x) : ¬ ∃ w : D.BlockWitness F A s, D.blockedOccurrence hp per F A s w = o := by …Mentions: OAI.Superstring.Hierarchical.Layer
- abbrev
OAI.Superstring.Hierarchical.Family.Occurrenceline 370Source documentation
All recorded occurrences, retaining the actual original layer as their owner.
abbrev Occurrence (s : List α) := Σ i, (D i).Occurrence s
- abbrev
OAI.Superstring.Hierarchical.Family.BlockWitnessline 373Source documentation
Bracketing witnesses over the whole fixed family of layers.
abbrev BlockWitness (F : Finset (List α)) (B : ℤ → α) (s : List α) := …
- def
OAI.Superstring.Hierarchical.Family.blockedOccurrenceline 376 - theorem
OAI.Superstring.Hierarchical.Family.blockedOccurrence_injectiveline 383 - theorem
OAI.Superstring.Hierarchical.Family.card_blockWitnessline 391 - theorem
OAI.Superstring.Hierarchical.Family.outside_image_and_predline 403Source documentation
An actual finite pigeonhole argument used by the period-rule forcing step.
theorem outside_image_and_pred {X Y : Type} [Fintype X] [Fintype Y] (f : X → Y) (P : Y → Prop) [Fintype {y // P y}] (k : ℕ) (hX : Fintype.card X + k < Fintype.card Y) (hP : Fintype.card {y // P y} ≤ k) : ∃ y, (¬ ∃ x, f x = y) ∧ ¬ P y := by … - theorem
OAI.Superstring.Hierarchical.Family.aligned_not_blockedline 427Source documentation
An aligned recorded occurrence is outside the global blocking image.
theorem aligned_not_blocked (hp : ∀ i, 0 < p i) (per : ∀ i, Function.Periodic (A i) (p i : ℤ)) (F : Finset (List α)) {B : ℤ → α} {s : List α} (o : Occurrence D s) (halign : ∀ x : ℤ, A o.1 (x + o.2.val.val) = B x) : ¬ ∃ w : BlockWitness D F B s, blockedOccurrence D hp per F B s w = o := by …Mentions: OAI.Superstring.Hierarchical.Family.Occurrence, OAI.Superstring.Hierarchical.Family.BlockWitness, OAI.Superstring.Hierarchical.Family.blockedOccurrence
- theorem
OAI.Superstring.Hierarchical.Family.blocking_lt_of_alignedline 441 - theorem
OAI.Superstring.Hierarchical.Family.matching_differentline 456Source documentation
The excess forced by a period rule produces a matching actual window on a DIFFERENT aligned text. The exceptional set must have the proved size bound k.
theorem matching_different [DecidableEq α] (hp : ∀ i, 0 < p i) (per : ∀ i, Function.Periodic (A i) (p i : ℤ)) (F : Finset (List α)) (hV : V = (F : Set (List α))) (closed : SubstringClosed V) {B : ℤ → α} {s : List α} (hB : Counts.Matches B s) (k : ℕ) (hexcess : Counts.blocking F B s (fun r => Fintype.card (Occurrence D r)) + k < Fintype.card (Occurrence D s)) (hfew : Nat.card {o : Occurrence D s // ∀ x : ℤ, A o.1 (x + o.2.val.val) = B x} ≤ k) : ∃ o : Occurrence D s, (¬ ∀ x : ℤ, A o.1 (x + o.2.val.val) = B x) ∧ ∃ a b : ℤ, a ≤ o.2.val.val ∧ (o.2.val.val : ℤ) + s.length ≤ b ∧ (D o.1).first a ≤ b ∧ b ≤ (D o.1).last a ∧ …Mentions: OAI.Superstring.Hierarchical.SubstringClosed, OAI.Superstring.Counts.Matches, OAI.Superstring.Counts.blocking, OAI.Superstring.Hierarchical.Family.Occurrence