Download data/lean/OAI/Combinatorics/EditDistance/Model.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 2.17 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditDistance/Model.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditDistance/Model.lean
-
curl -L -o Model.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditDistance/Model.lean
2.17 kB
| import Mathlib | |
| import OAI.Combinatorics.EditApproximation.Definitions | |
| namespace OAI | |
| namespace EditDistortion | |
| universe u | |
| /- A single unit-cost insertion, deletion, or (when enabled) substitution. -/ | |
| /- An unrestricted script of exactly n unit edits. -/ | |
| /-- Minimum script length. Scripts always exist (delete x and insert y). -/ | |
| abbrev L1 := lp (fun _ : β => β) 1 | |
| /-- The product of the two maximal distance ratios. -/ | |
| noncomputable def distortion {X : Type u} (Ο : X β X β β) (f : X βͺ L1) : β := | |
| sSup {r : β | β x y : X, x β y β§ r = βf x - f yβ / Ο x y} * | |
| sSup {r : β | β x y : X, x β y β§ r = Ο x y / βf x - f yβ} | |
| /-- The infimum over injective maps to real absolutely summable sequences. -/ | |
| noncomputable def leastDistortion {X : Type u} (Ο : X β X β β) : β := | |
| sInf (Set.range (distortion Ο)) | |
| abbrev Words (Alpha : Type u) (d : β) := {x : List Alpha // x.length β€ d} | |
| noncomputable def E (Alpha : Type u) (d : β) : β := | |
| leastDistortion (fun x y : Words Alpha d => (edit x.val y.val : β)) | |
| noncomputable def exponentScale (c : β) (d : β) : β := | |
| Real.exp (c * Real.sqrt (Real.log (d : β) * Real.log (Real.log (d : β)))) | |
| /-- Supremum over finite alphabet cardinalities. -/ | |
| noncomputable def alphabetSup (d : β) : β := | |
| sSup {r : β | β n : β, 2 β€ n β§ r = E (Fin n) d} | |
| /-- A finite nonempty subset of binary words of one common length. -/ | |
| def BinaryWitness (c : β) (d : β) : Prop := | |
| β n : β, n β€ d β§ β S : Set (List Bool), S.Finite β§ S.Nonempty β§ | |
| (β w β S, w.length = n) β§ | |
| exponentScale c d β€ leastDistortion (fun x y : S => (edit x.val y.val : β)) | |
| /-- Uniform two-sided bounds with common positive constants and threshold. -/ | |
| def MainClaim : Prop := | |
| β c C : β, 0 < c β§ 0 < C β§ β dβ : β, β d : β, dβ β€ d β | |
| (β (Alpha : Type u) [Fintype Alpha], 2 β€ Fintype.card Alpha β | |
| exponentScale c d β€ E Alpha d β§ E Alpha d β€ exponentScale C d) β§ | |
| BinaryWitness c d β§ | |
| exponentScale c d β€ alphabetSup d β§ alphabetSup d β€ exponentScale C d | |
| end EditDistortion | |
| end OAI | |