Download data/lean/OAI/Combinatorics/EditApproximation/Queries/QueryBufferedSourceBounds.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.56 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Queries/QueryBufferedSourceBounds.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/EditApproximation/Queries/QueryBufferedSourceBounds.lean
-
curl -L -o QueryBufferedSourceBounds.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/EditApproximation/Queries/QueryBufferedSourceBounds.lean
3.56 kB
| import OAI.Combinatorics.EditApproximation.Queries.QueryBufferedSharedCost | |
| namespace OAI | |
| namespace EditApproximation.BinaryFraction | |
| theorem queryBufferedGroupReadCost {n M N F Q : β} [NeZero M] | |
| (exponent eM eF B V : β) (hMdef : M = 2 ^ eM) (hFdef : F = 2 ^ eF) | |
| (a value : BinaryFraction) (q : TargetInterval n) (words : List BinaryFraction) | |
| (hB : 7 β€ B) (hN : Nat.size N β€ B) (hF : Nat.size F + 2 β€ B) | |
| (hM : Nat.size M + 2 β€ B) (hQ : Nat.size Q + 2 β€ B) (hes : eM + eF + 7 β€ B) | |
| (he : exponent + 1 β€ B) (hn : Nat.size n β€ B) (ha : a.width β€ B) | |
| (hv : value.width β€ B) (hw : 0 β€ value.value) (hV : 2 β€ V) | |
| (hwords : β v β words, v.width β€ V) : | |
| let keys := (queryGroupSourceKeysWithWork M N F Q exponent eM eF hMdef hFdef a value q).1 | |
| β eb β List.range (max 1 N.bits.length), | |
| (refinementScaleGuardWithWork F (2 ^ eb) a value).1 = true β | |
| β cell β (targetCellsWithWork | |
| (canonicalMulWithWork (inversePowerTwo exponent) (nat (2 ^ eb))).1 | |
| (bitWordValue (naturalCeilingWithWork value).1) q).1, | |
| β scale sample, (queryGroupDrawReadWithWork keys words (2 ^ eb) cell scale sample).2 β€ | |
| queryBufferedGroupReadBudget M F exponent eM eF B V := by | |
| dsimp only | |
| intro eb heb hg cell hc scale sample | |
| have hk := (queryGroupSourceKeysWithWork_bounds M N F Q exponent eM eF B hMdef hFdef a value q | |
| hB hN hF hM hQ hes he hn ha hv hw).1 | |
| have hr := queryGroupDrawReadWithWork_scoped_cost exponent eM eF B V hMdef hFdef a value q words | |
| hB hN hF (by omega) (by omega) he hn ha hv hw hV hwords eb heb hg cell hc scale sample | |
| apply hr.trans | |
| unfold queryBufferedGroupReadBudget queryGroupBufferReadBudget | |
| gcongr | |
| theorem queryBufferedOnlineReadCost {n : β} (N P F B V : β) (hP : 0 < P) | |
| (a value : BinaryFraction) (q : TargetInterval n) (words : List BinaryFraction) | |
| (hB : 7 β€ B) (hN : Nat.size N β€ B) (hF : Nat.size F + 2 β€ B) (hFpos : 1 β€ F) | |
| (hPb : Nat.size P β€ B) (hn : Nat.size n β€ B) (ha : a.width β€ B) (hv : value.width β€ B) | |
| (hV : 2 β€ V) (hwords : β v β words, v.width β€ V) : | |
| let keys := (queryOnlineKeysWithWork N P F hP a value q).1 | |
| β e β (queryExponentsWithWork N F a value).1, | |
| (queryOnlineIntegerReadWithWork keys words (2 ^ e) | |
| (roundStateWithWork (bitWordValue (seedGridSpacingWithWork (2 ^ e) P).1) | |
| (seedGridSpacingWithWork_pos (2 ^ e) P hP) q).1).2 β€ | |
| queryOnlineBufferReadBudget (B + 1) B V := by | |
| dsimp only | |
| intro e he | |
| have hk := (queryOnlineKeysWithWork_bounds N P F B hP a value q hB hN hF hFpos hPb hn ha hv).1 | |
| have hr := queryOnlineIntegerReadWithWork_scoped_cost N P F B V hP a value q words | |
| hN hFpos hn hV hwords e he | |
| apply hr.trans | |
| unfold queryOnlineBufferReadBudget | |
| gcongr | |
| theorem queryOnlineIntegerReadWithWork_size {n : β} | |
| (keys : List (β Γ TargetInterval n)) (words : List BinaryFraction) (b : β) (q : TargetInterval n) | |
| (V : β) (hV : 2 β€ V) (hwords : β v β words, v.width β€ V) : | |
| Nat.size (queryOnlineIntegerReadWithWork keys words b q).1 β€ V := by | |
| let word := gatheredWordLookupWithWork queryOnlineKeyEqualWithWork keys words (b, q) | |
| have hw : word.1.width β€ V := gatheredWordLookupWithWork_width _ keys words _ V hV hwords | |
| have hf := (naturalFloorWithWork_bounds word.1).1 | |
| change Nat.size (bitWordValue (naturalFloorWithWork word.1).1) β€ V | |
| exact (Nat.size_le.mpr (bitWordValue_lt_pow_length _)).trans (hf.trans hw) | |
| end EditApproximation.BinaryFraction | |
| end OAI | |