OAI/Combinatorics/BinaryEdit/TaggedExtraction.lean
18 declarations, 0 contain sorry, 0 declared as axioms
- theorem
OAI.TreeEdit.BinaryLower.TaggedExtraction.exists_maximum_matchingline 16Source documentation
Every canonical LCS is witnessed by a numerically indexed increasing matching.
theorem exists_maximum_matching (x y : List α) : ∃ N : ℕ, N = lcs x y ∧ ∃ (u v : Fin N → ℕ) (hu : ∀ i, u i < x.length) (hv : ∀ i, v i < y.length), StrictMono u ∧ StrictMono v ∧ (∀ i, x[u i]'(hu i) = y[v i]'(hv i)) := by …Mentions: OAI.TreeEdit.lcs
- def
OAI.TreeEdit.BinaryLower.TaggedExtraction.blocksline 28Source documentation
A row obtained by concatenating equal-width blocks in increasing index order.
def blocks {m B : ℕ} (X : Fin m → Word α B) : List α := …Mentions: OAI.TreeEdit.Word
- lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.blocks_succline 31 - lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.length_blocksline 35 - lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.block_index_ltline 44 - lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.getElem_blocksline 52Source documentation
Indexing a concatenated row at block
iand within-block positionj.lemma getElem_blocks {m B : ℕ} (X : Fin m → Word α B) (i : Fin m) (j : Fin B) : (blocks X)[i.val * B + j.val]'(by rw [length_blocks]; exact block_index_lt i j) = (X i).val[j.val]'(by rw [(X i).property]; exact j.isLt) := by …Mentions: OAI.TreeEdit.Word, OAI.TreeEdit.BinaryLower.TaggedExtraction.blocks, OAI.TreeEdit.BinaryLower.TaggedExtraction.length_blocks, OAI.TreeEdit.BinaryLower.TaggedExtraction.block_index_lt
- def
OAI.TreeEdit.BinaryLower.TaggedExtraction.rowsline 71Source documentation
Trows ofmblocks of widthB.def rows {T m B : ℕ} (X : Fin T → Fin m → Word α B) : List α := …Mentions: OAI.TreeEdit.Word
- lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.rows_eq_flatMapline 74 - lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.length_rowsline 78 - lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.row_index_ltline 83 - lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.getElem_rowsline 89Source documentation
Indexed extraction of a cell from the literal concatenation of rows.
lemma getElem_rows {T m B : ℕ} (X : Fin T → Fin m → Word α B) (a : Fin T) (i : Fin m) (j : Fin B) : (rows X)[a.val * (m * B) + (i.val * B + j.val)]' (by rw [length_rows]; exact row_index_lt a i j) = (X a i).val[j.val]'(by rw [(X a i).property]; exact j.isLt) := by …Mentions: OAI.TreeEdit.Word, OAI.TreeEdit.BinaryLower.TaggedExtraction.rows, OAI.TreeEdit.BinaryLower.TaggedExtraction.length_rows, OAI.TreeEdit.BinaryLower.TaggedExtraction.row_index_lt
- lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.row_quotient_ltline 99 - lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.row_quotient_decompositionline 104 - lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.getElem_rows_quotientline 113Source documentation
Quotient/remainder form matching the numerical tagged-row geometric lemmas.
lemma getElem_rows_quotient {T m B : ℕ} (X : Fin T → Fin m → Word α B) (hm : 0 < m) (hB : 0 < B) (p : ℕ) (hp : p < T * m * B) : (rows X)[p]'(by rw [length_rows]; exact hp) = (X ⟨p / B / m, row_quotient_lt hm hB hp⟩ ⟨p / B % m, Nat.mod_lt _ hm⟩).val[p % B]' (by rw [(X _ _).property]; exact Nat.mod_lt _ hB) := by …Mentions: OAI.TreeEdit.Word, OAI.TreeEdit.BinaryLower.TaggedExtraction.rows, OAI.TreeEdit.BinaryLower.TaggedExtraction.length_rows, OAI.TreeEdit.BinaryLower.TaggedExtraction.row_quotient_lt
- lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.equal_symbols_same_tagline 126Source documentation
Pairwise-disjoint letter tags force equal matched positions to have the same block index. The assumption is only cross-family disjointness; no row-boundary alignment is assumed.
lemma equal_symbols_same_tag {T m B : ℕ} (X Y : Fin T → Fin m → Word α B) (hm : 0 < m) (hB : 0 < B) (hdisjoint : ∀ (a b : Fin T) (i j : Fin m) (s : α), s ∈ (X a i).val → s ∈ (Y b j).val → i = j) (p q : ℕ) (hp : p < T * m * B) (hq : q < T * m * B) (heq : (rows X)[p]'(by rw [length_rows]; exact hp) = (rows Y)[q]'(by rw [length_rows]; exact hq)) : p / B % m = q / B % m := by …Mentions: OAI.TreeEdit.Word, OAI.TreeEdit.BinaryLower.TaggedExtraction.rows, OAI.TreeEdit.BinaryLower.TaggedExtraction.length_rows
- theorem
OAI.TreeEdit.BinaryLower.TaggedExtraction.exists_maximum_row_matchingline 149Source documentation
A longest matching of tagged rows supplies the precise natural-coordinate interface used by the split-row gap bound, including the zero-match case.
theorem exists_maximum_row_matching {T m B : ℕ} (X Y : Fin T → Fin m → Word α B) (hm : 0 < m) (hB : 0 < B) (hdisjoint : ∀ (a b : Fin T) (i j : Fin m) (s : α), s ∈ (X a i).val → s ∈ (Y b j).val → i = j) : ∃ N : ℕ, N = lcs (rows X) (rows Y) ∧ ∃ (u v : Fin N → ℕ) (hu : ∀ i, u i < T * m * B) (hv : ∀ i, v i < T * m * B), StrictMono u ∧ StrictMono v ∧ (∀ i, u i / B % m = v i / B % m) ∧ (∀ i, (rows X)[u i]'(by rw [length_rows]; exact hu i) = (rows Y)[v i]'(by rw [length_rows]; exact hv i)) := by …Mentions: OAI.TreeEdit.Word, OAI.TreeEdit.lcs, OAI.TreeEdit.BinaryLower.TaggedExtraction.rows, OAI.TreeEdit.BinaryLower.TaggedExtraction.length_rows
- lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.cross_disjoint_of_tagsline 169Source documentation
Ordered tags expressed as a single decoder imply the disjointness premise above.
lemma cross_disjoint_of_tags {T m B : ℕ} (X Y : Fin T → Fin m → Word α B) (tag : α → Fin m) (hX : ∀ (a : Fin T) (i : Fin m) (s : α), s ∈ (X a i).val → tag s = i) (hY : ∀ (a : Fin T) (i : Fin m) (s : α), s ∈ (Y a i).val → tag s = i) : ∀ (a b : Fin T) (i j : Fin m) (s : α), s ∈ (X a i).val → s ∈ (Y b j).val → i = j := by …Mentions: OAI.TreeEdit.Word
- lemma
OAI.TreeEdit.BinaryLower.TaggedExtraction.equal_symbols_same_tag_of_decoderline 179Source documentation
The global-symbol interface required by the tagged slice-alignment theorem.
lemma equal_symbols_same_tag_of_decoder {T m B : ℕ} (X Y : Fin T → Fin m → Word α B) (tag : α → Fin m) (hX : ∀ (a : Fin T) (i : Fin m) (s : α), s ∈ (X a i).val → tag s = i) (hY : ∀ (a : Fin T) (i : Fin m) (s : α), s ∈ (Y a i).val → tag s = i) (hm : 0 < m) (hB : 0 < B) (p q : ℕ) (hp : p < T * m * B) (hq : q < T * m * B) (heq : (rows X)[p]'(by rw [length_rows]; exact hp) = (rows Y)[q]'(by rw [length_rows]; exact hq)) : p / B % m = q / B % m := …Mentions: OAI.TreeEdit.Word, OAI.TreeEdit.BinaryLower.TaggedExtraction.rows, OAI.TreeEdit.BinaryLower.TaggedExtraction.length_rows