Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-gpu-driver/blob/main/tests/arena_bytes.lean # omega-gpu-driver aien-dev/omega-gpu-driver Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-gpu-driver / tests / arena_bytes.lean` 28 lines · 967 bytes Raw Blame History 1 import Std.Tactic.BVDecide 2 3 namespace ArenaBytes 4 5 -- The upper byte offsets and word indices used by arword and arshift. 6 theorem bounds (o : Nat) (lo : `16777216` ≤ o) (hi : o < `83886080`) : 7 (o - `16777216`) / 8 < `8388608` ∧ 8 `16777216` + 8 * ((o - `16777216`) / 8) + o % 8 = o := by omega 9 10 def shift (lane : BitVec 3) : BitVec 64 := lane.zeroExtend 64 <<< 3 11 12 def getByte (w : BitVec 64) (lane : BitVec 3) : BitVec 8 := 13 (w >>> shift lane).truncate 8 14 15 def setByte (w : BitVec 64) (lane : BitVec 3) (v : BitVec 8) : BitVec 64 := 16 (w &&& ~~~((255 : BitVec 64) <<< shift lane)) ||| (v.zeroExtend 64 <<< shift lane) 17 18 theorem readWrite (w : BitVec 64) (lane : BitVec 3) (v : BitVec 8) : 19 getByte (setByte w lane v) lane = v := by 20 unfold getByte setByte shift 21 bv_decide 22 23 theorem otherLanes (w : BitVec 64) (a b : BitVec 3) (v : BitVec 8) (h : a ≠ b) : 24 getByte (setByte w a v) b = getByte w b := by 25 unfold getByte setByte shift 26 bv_decide 27 28 end ArenaBytes