Buckets:
| import OAI.Combinatorics.EditApproximation.Binary.BinaryArithmeticWork | |
| import OAI.Combinatorics.EditApproximation.Definitions | |
| namespace OAI | |
| /-! Removing only leading zero bits of an integer word. This is unrelated | |
| to rational reduction: no common divisor is computed. -/ | |
| namespace EditApproximation | |
| theorem trimBitWordWithWork_value (bits : List Bool) : | |
| bitWordValue (trimBitWordWithWork bits).1 = bitWordValue bits := by | |
| induction bits with | |
| | nil => rfl | |
| | cons bit bits ih => | |
| simp only [trimBitWordWithWork] | |
| split_ifs with h | |
| · have ht : bitWordValue bits = 0 := by rw [← ih, h.1]; rfl | |
| simp [h.2, bitWordValue, ht] | |
| · simp only [bitWordValue, ih] | |
| theorem trimBitWordWithWork_canonical (bits : List Bool) : | |
| (trimBitWordWithWork bits).1 = (bitWordValue bits).bits := by | |
| induction bits with | |
| | nil => rfl | |
| | cons bit bits ih => | |
| by_cases hzero : bitWordValue bits = 0 | |
| · rw [trimBitWordWithWork, ih, hzero] | |
| cases bit <;> simp [bitWordValue, hzero] | |
| · have hnonempty : (bitWordValue bits).bits ≠ [] := by | |
| intro h | |
| have hv := bitWordValue_bits (bitWordValue bits) | |
| rw [h] at hv | |
| exact hzero hv.symm | |
| have hvalue : bitWordValue (bit :: bits) = Nat.bit bit (bitWordValue bits) := by | |
| cases bit <;> simp [bitWordValue, Nat.bit, Nat.add_comm] | |
| rw [trimBitWordWithWork, ih, ite_eq_right (by simp [hnonempty]), hvalue, | |
| Nat.bits_append_bit _ _ (fun h => False.elim (hzero h))] | |
| theorem trimBitWordWithWork_length (bits : List Bool) : | |
| (trimBitWordWithWork bits).1.length = Nat.size (bitWordValue bits) := by | |
| rw [trimBitWordWithWork_canonical, Nat.size_eq_bits_len] | |
| theorem trimBitWordWithWork_cost (bits : List Bool) : | |
| (trimBitWordWithWork bits).2 = 3 * bits.length + 1 := by | |
| induction bits with | |
| | nil => rfl | |
| | cons bit bits ih => | |
| simp only [trimBitWordWithWork, List.length_cons, ih] | |
| omega | |
| end EditApproximation | |
| end OAI | |
Xet Storage Details
- Size:
- 1.96 kB
- Xet hash:
- 391970c88896c6aa4a9863e0eab861e4cf4336abd064c9899e46f0cc4225d817
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.