cfahlgren1's picture
download
raw
3.2 kB
import OAI.Combinatorics.EditApproximation.Coarse.CoarseRootWork
namespace OAI
namespace EditApproximation
namespace BinaryFraction
theorem coarseBinaryRead_width (array : CoarseBinaryArray) (i A : ℕ)
(hA : 2 ≤ A) (hw : ∀ cells, array = some cells → ∀ a ∈ cells, a.width ≤ A) :
(coarseBinaryRead array i).width ≤ A := by
cases array with
| none => exact (nat_width_le 0).trans (by simpa using hA)
| some cells =>
simp only [coarseBinaryRead]
cases h : cells[i]? with
| none => exact (nat_width_le 0).trans (by simpa using hA)
| some a => exact hw cells rfl a (List.mem_of_getElem? h)
theorem coarseRootWithWork_width {B d : ℕ} {α : Type*} [DecidableEq α]
(k q L N D A : ℕ) (hB : 0 < B) (hq : 0 < q) (hL : 0 < L)
(frame : List (Option α)) (tree : CoarseSourceTree B α d)
(draws : CoarseThresholdDraws B d) (start : ℕ) (shift : Fin (2 * k + 1))
(hBbits : Nat.size B + 2 ≤ A) (hqbits : Nat.size q + 2 ≤ A)
(hLbits : Nat.size L + 2 ≤ A) (hNbits : Nat.size N + 2 ≤ A)
(hd : Nat.size (coarseCommonDenominator 1 q L B d) ≤ D)
(hbound : Nat.size (coarseLevelMagnitude N k B d + 2) + 2 * D + 1 ≤ A)
(hstart : start + tree.word.length ≤ N) :
(coarseRootWithWork k q L hB hq hL frame tree draws start shift).1.width ≤ A := by
let den := coarseRootDenominator B q L d
let denPos := coarseRootDenominator_pos B q L d hB hq hL
let two := (coarseGridNatWithWork den.1 denPos 2).1
let allowance := (coarseGridNatWithWork den.1 denPos k).1
have hden := coarseRootDenominator_value B q L d
have hdenLen : den.1.length ≤ D := (coarseRootDenominator_length B q L d).trans_le hd
have htwo : two.value = 2 := coarseGridNatWithWork_value _ _ 2
have htwoDen : two.representation.den = coarseCommonDenominator 1 q L B d :=
(coarseGridNatWithWork_den _ _ 2).trans hden
have hkwidth : Nat.size k + 2 * D + 1 ≤ A :=
(Nat.add_le_add_right (Nat.add_le_add_right (Nat.size_le_size
((coarseLevelMagnitude_ge N k B d).trans (by omega))) _) _).trans hbound
have h2width : Nat.size 2 + 2 * D + 1 ≤ A :=
(Nat.add_le_add_right (Nat.add_le_add_right (Nat.size_le_size
(by omega : 2 ≤ coarseLevelMagnitude N k B d + 2)) _) _).trans hbound
have htwocell : CoarseGridCell two two 2 D A :=
coarseGridNatWithWork_bounds two den.1 denPos 2 2 D A
(coarseGridNatWithWork_den _ _ 2).symm hdenLen le_rfl h2width
have hacell : CoarseGridCell two allowance k D A :=
coarseGridNatWithWork_bounds two den.1 denPos k k D A
(coarseGridNatWithWork_den _ _ 2).symm hdenLen le_rfl hkwidth
have hav : allowance.value = k := coarseGridNatWithWork_value _ _ k
have hpath : allowance.value.den ∣ (L * B * q) ^ 0 := by
simp only [hav, Rat.den_natCast, one_dvd]
have hc := (coarseBinaryEval_bitWork k q L N d D A frame two tree draws hB hq hL htwo
htwocell.2.2.2.2 (by rw [htwoDen]; exact hd) htwoDen hBbits hqbits hLbits hNbits hbound
0 (by omega) allowance start hacell hpath hstart).1
apply coarseBinaryRead_width _ _ A (by omega)
intro cells heq a ha
exact ((hc cells heq).2 a ha).2.2.2.2
end BinaryFraction
end EditApproximation
end OAI

Xet Storage Details

Size:
3.2 kB
·
Xet hash:
f3e84fbcc75a315a3613009644ee4f5613b503834ecc844262a9c8b992fa9fda

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.