introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
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