Download data/lean/OAI/Combinatorics/EditApproximation/Specification/FootprintMain.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 6.52 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Specification/FootprintMain.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/Specification/FootprintMain.lean
-
curl -L -o FootprintMain.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Specification/FootprintMain.lean
6.52 kB
| import OAI.Combinatorics.EditApproximation.Specification.ConcreteFootprintBridges | |
| import OAI.Combinatorics.EditApproximation.Definitions | |
| namespace OAI.EditApproximation | |
| open Filter MeasureTheory | |
| attribute [local instance] queryRoundsNeZero | |
| def computedQueryTemporaryCellsFootprint (source target : List β) (N : β) | |
| (occurrence : BinaryMemo PositionCounts) (symbolBits positionBits : β) | |
| (input : ComputedFamilyInput source target N) : β := | |
| BitQuery.Footprint.rankedBitMemoCells (SourceRanked.rank ChargedPhysicalRequest.rank) | |
| (computedQueryMemoNormalized source target N occurrence symbolBits positionBits input) | |
| (computedQueryMemoFootprint source target N occurrence symbolBits positionBits input) | |
| (16384 * inputHeight N + 5) (computedFamilyMemoCode source target N (inputHeight N ^ 2)) | |
| (fun key => (computedFamilyMemoCodeWithWork source target N (inputHeight N ^ 2) key).2) | |
| (.inr (localFinalRootRequest target N (integerParameters N).T (integerParameters N).S | |
| (inputHeight N) (Nat.two_pow_pos _) (finalTargetState target.length))) .empty | |
| noncomputable def integerAcceptedSpaceTermsFootprint (source target : List β€) (N : β) | |
| (epsilon : BinaryFraction) | |
| (input : ComputedFamilyInput (source.map integerSymbolCode) (target.map integerSymbolCode) N) : List β := | |
| let x := source.map integerSymbolCode | |
| let y := target.map integerSymbolCode | |
| [8 * integerPreevaluationWork source target N epsilon, | |
| 2 * integerStoredDataSpace source target, | |
| computedQuerySetupAllocation N, | |
| (computedQueryMemoResult x y N (integerOccurrenceIndex source target) | |
| (integerInputSymbolBits source target) (integerInputPositionBits target) input).memory.fractionStorage, | |
| computedQueryTemporaryCellsFootprint x y N (integerOccurrenceIndex source target) | |
| (integerInputSymbolBits source target) (integerInputPositionBits target) input, | |
| computedFamilyCoarseCopyStorage x y N input, | |
| computedFamilyCoarseArrayCapacity x y N input, | |
| computedFamilyCoarseScratchCapacity x y N input, | |
| computedFamilyCoarseControlCapacity x y N input, | |
| 4 * (inputHeight N + (integerParameters N).B + 4), | |
| integerFinalAllocation source target N input, | |
| 8 * (N + 1)] | |
| noncomputable def integerBinarySpaceFootprint (source target : List β€) (N : β) (epsilon : BinaryFraction) | |
| (outcome : ComputedFullOutcome (source.map integerSymbolCode) (target.map integerSymbolCode) N) : β := | |
| if physicalLargeInput N epsilon then | |
| match outcome with | |
| | .inl _ => 8 * integerPreevaluationWork source target N epsilon + | |
| 2 * integerStoredDataSpace source target + | |
| suffixDPAllocation (source.map integerSymbolCode) (target.map integerSymbolCode) + 8 * (N + 1) | |
| | .inr execution => (integerAcceptedSpaceTermsFootprint source target N epsilon | |
| (computedExecutionAccepted _ _ N execution)).sum | |
| else 8 * integerPreevaluationWork source target N epsilon + | |
| 2 * integerStoredDataSpace source target + | |
| suffixDPAllocation (source.map integerSymbolCode) (target.map integerSymbolCode) + 8 * (N + 1) | |
| theorem computedQueryTemporaryCellsFootprint_eq (source target : List β) (N : β) | |
| (occurrence : BinaryMemo PositionCounts) (symbolBits positionBits : β) | |
| (input : ComputedFamilyInput source target N) : | |
| computedQueryTemporaryCellsFootprint source target N occurrence symbolBits positionBits input = | |
| computedQueryTemporaryCells source target N occurrence symbolBits positionBits input := by | |
| have h : computedQueryMemoFootprint source target N occurrence symbolBits positionBits input = | |
| (fun key => (computedQueryMemoHeap source target N occurrence symbolBits positionBits input key).footprint) := by | |
| funext key | |
| exact (computedQueryMemoHeap_footprint source target N occurrence symbolBits positionBits input key).symm | |
| unfold computedQueryTemporaryCellsFootprint computedQueryTemporaryCells | |
| rw [h] | |
| exact BitQuery.Heap.footprint_rankedBitMemoCells _ _ _ _ _ _ _ _ | |
| theorem integerAcceptedSpaceTermsFootprint_eq (source target : List β€) (N : β) | |
| (epsilon : BinaryFraction) | |
| (input : ComputedFamilyInput (source.map integerSymbolCode) (target.map integerSymbolCode) N) : | |
| integerAcceptedSpaceTermsFootprint source target N epsilon input = | |
| integerAcceptedSpaceTerms source target N epsilon input := by | |
| simp only [integerAcceptedSpaceTermsFootprint, integerAcceptedSpaceTerms, | |
| computedQueryTemporaryCellsFootprint_eq] | |
| theorem integerBinarySpaceFootprint_eq (source target : List β€) (N : β) (epsilon : BinaryFraction) | |
| (outcome : ComputedFullOutcome (source.map integerSymbolCode) (target.map integerSymbolCode) N) : | |
| integerBinarySpaceFootprint source target N epsilon outcome = | |
| integerBinarySpace source target N epsilon outcome := by | |
| simp only [integerBinarySpaceFootprint, integerBinarySpace, integerAcceptedSpaceTermsFootprint_eq] | |
| rfl | |
| theorem almostLinearEditDistance_main (epsilon : BinaryFraction) | |
| (hepsilon : 0 < epsilon.value) (_hepsilonOne : epsilon.value < 1) | |
| : | |
| (β (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, integerBinarySpaceFootprint source target N epsilon outcome β€ (N + 2) ^ (C + 65564)) := by | |
| simpa only [integerBinarySpaceFootprint_eq] using | |
| almostLinearEditDistance epsilon hepsilon _hepsilonOne | |
| end OAI.EditApproximation | |