Download data/lean/OAI/Combinatorics/EditApproximation/AlmostLinearConditional.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.33 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/AlmostLinearConditional.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/AlmostLinearConditional.lean
-
curl -L -o AlmostLinearConditional.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/AlmostLinearConditional.lean
3.33 kB
| import OAI.Combinatorics.EditApproximation.Binary.IntegerBinaryAccuracy | |
| import OAI.Combinatorics.EditApproximation.Binary.IntegerBinarySpace | |
| namespace OAI | |
| /-! An edit-distance approximation scheme conditional on finite scalar | |
| Bernstein concentration (Tropp, ACM217, corrected 2023, Theorem 4.16). | |
| The same uniform binary algorithm is used in all four clauses. -/ | |
| namespace EditApproximation | |
| open MeasureTheory Filter | |
| /-- For each fixed binary accuracy in `(0,1)`, the concrete uniform algorithm | |
| has success probability at least `2/3`, deterministic zero on equal inputs, | |
| worst-case expected almost-linear time including preprocessing and sampling, | |
| and polynomial space on every outcome. Alphabet bounds are analysis parameters, | |
| not inputs to the algorithm. The finite initial range uses exact suffix DP. -/ | |
| theorem almostLinearEditDistance_conditional (epsilon : BinaryFraction) | |
| (hepsilon : 0 < epsilon.value) (_hepsilonOne : epsilon.value < 1) | |
| (bernstein : β N, ComputedBernsteinInputs N) : | |
| (β (source target : List β€) (N : β), source.length + target.length β€ N β | |
| (2 / 3 : β) β€ (computedFullLaw (source.map integerSymbolCode) (target.map integerSymbolCode) N epsilon).real | |
| {outcome | EditDistortion.edit source target β€ integerBinaryAnswer source target N epsilon outcome β§ | |
| (integerBinaryAnswer source target N epsilon outcome : β) β€ | |
| (1 + (epsilon.value : β)) * EditDistortion.edit source target}) β§ | |
| (β (source target : List β€) (N : β), source = target β β outcome, | |
| integerBinaryAnswer source target N epsilon outcome = 0) β§ | |
| (β (C : β) (eta : β), 0 < eta β βαΆ N : β in atTop, | |
| β source target : List β€, source.length + target.length β€ N β | |
| (β z β source ++ target, z.natAbs β€ (N + 2) ^ C) β | |
| (β« outcome, integerBinaryWork source target N epsilon outcome | |
| βcomputedFullLaw (source.map integerSymbolCode) (target.map integerSymbolCode) N epsilon) β€ | |
| (N + 2 : β) ^ (1 + eta)) β§ | |
| (β C : β, βαΆ N : β in atTop, β source target : List β€, | |
| source.length + target.length β€ N β | |
| (β z β source ++ target, z.natAbs β€ (N + 2) ^ C) β | |
| β outcome, integerBinarySpace source target N epsilon outcome β€ (N + 2) ^ (C + 65564)) := by | |
| refine β¨?_, ?_, ?_, ?_β© | |
| Β· intro source target N hsize | |
| exact integerBinaryAnswer_conditional_accuracy source target N epsilon hepsilon hsize (bernstein N) | |
| Β· intro source target N heq outcome | |
| exact integerBinaryAnswer_equal source target N epsilon heq outcome | |
| Β· intro C eta heta | |
| exact integerBinaryWork_expected_near_linear C epsilon hepsilon eta heta | |
| Β· intro C | |
| exact integerBinarySpace_polynomial C epsilon hepsilon | |
| /-- The cutoff selects an exact answer, rather than leaving the small-input | |
| regime outside the uniform algorithm's correctness statement. -/ | |
| theorem integerBinaryAnswer_fallback (source target : List β€) (N : β) (epsilon : BinaryFraction) | |
| (hsmall : Β¬ physicalLargeInput N epsilon) (outcome) : | |
| integerBinaryAnswer source target N epsilon outcome = EditDistortion.edit source target := by | |
| simp only [integerBinaryAnswer, hsmall, ite_false, exactSuffixAnswer_eq_edit, integerSymbols_edit] | |
| end EditApproximation | |
| end OAI | |