Buckets:
| import OAI.Combinatorics.EditApproximation.Binary.BinaryCeilingWork | |
| import OAI.Combinatorics.EditApproximation.Geometry.Grid | |
| import OAI.Combinatorics.EditApproximation.Definitions | |
| namespace OAI | |
| /-! Endpoint rounding executed by binary division followed by multiplication. -/ | |
| namespace EditApproximation | |
| theorem binaryGridRoundWithWork_value (spacing position : ℕ) (hspacing : 0 < spacing) : | |
| bitWordValue (binaryGridRoundWithWork spacing position).1 = gridRound spacing position := by | |
| simp only [binaryGridRoundWithWork, bitMulWithWork_value, bitWordValue_bits, | |
| (binaryNaturalDivModWithWork_spec position spacing hspacing).1, gridRound] | |
| theorem binaryGridRoundWithWork_cost (spacing position : ℕ) : | |
| (binaryGridRoundWithWork spacing position).2 ≤ | |
| 60 * (Nat.size spacing + Nat.size position + 1) ^ 2 := by | |
| have hd := binaryNaturalDivModWithWork_cost position spacing | |
| have hq := (bitDivModWithWork_lengths spacing.bits position.bits).1 | |
| have hm := bitMulWithWork_cost spacing.bits (binaryNaturalDivModWithWork position spacing).1 | |
| change (binaryNaturalDivModWithWork position spacing).1.length = position.bits.length at hq | |
| simp only [Nat.size_eq_bits_len] at hq hm | |
| rw [hq] at hm | |
| change (binaryNaturalDivModWithWork position spacing).2.2 + | |
| (bitMulWithWork spacing.bits (binaryNaturalDivModWithWork position spacing).1).2 + 2 ≤ _ | |
| nlinarith only [hd, hm, Nat.zero_le (Nat.size spacing), Nat.zero_le (Nat.size position)] | |
| theorem binaryIntervalRoundWithWork_value {n : ℕ} (spacing : ℕ) (hspacing : 0 < spacing) | |
| (q : TargetInterval n) : | |
| (bitWordValue (binaryIntervalRoundWithWork spacing q.lo q.hi).1.1, | |
| bitWordValue (binaryIntervalRoundWithWork spacing q.lo q.hi).1.2) = | |
| ((roundInterval spacing q).lo, (roundInterval spacing q).hi) := by | |
| simp only [binaryIntervalRoundWithWork, binaryGridRoundWithWork_value _ _ hspacing, | |
| roundInterval] | |
| theorem binaryIntervalRoundWithWork_cost (spacing lo hi B : ℕ) | |
| (hs : Nat.size spacing ≤ B) (hl : Nat.size lo ≤ B) (hh : Nat.size hi ≤ B) : | |
| (binaryIntervalRoundWithWork spacing lo hi).2 ≤ 500 * (B + 1) ^ 2 := by | |
| have hleft := binaryGridRoundWithWork_cost spacing lo | |
| have hright := binaryGridRoundWithWork_cost spacing hi | |
| have hfirst := Nat.mul_self_le_mul_self (show Nat.size spacing + Nat.size lo + 1 ≤ 2 * B + 1 by omega) | |
| have hsecond := Nat.mul_self_le_mul_self (show Nat.size spacing + Nat.size hi + 1 ≤ 2 * B + 1 by omega) | |
| simp only [← pow_two] at hfirst hsecond | |
| change (binaryGridRoundWithWork spacing lo).2 + (binaryGridRoundWithWork spacing hi).2 + 1 ≤ _ | |
| nlinarith only [hleft, hright, hfirst, hsecond, Nat.zero_le B] | |
| end EditApproximation | |
| end OAI | |
Xet Storage Details
- Size:
- 2.71 kB
- Xet hash:
- e5d76a91dab1f3b45851d0ff97a16d14c8792732acbd46b04374e19a7372214e
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.