lean4-htt/tests/lean/run/bv_uninterpreted.lean
Kim Morrison e69bcb0757
chore: improve BitVec ext lemmas (#6349)
This PR modifies `BitVec` extensionality lemmas to prefer bounded Nats
over `Fin`, and avoids unnecessary use of `bif` in BitVec theorems.
2024-12-10 01:33:09 +00:00

22 lines
646 B
Text

import Std.Tactic.BVDecide
-- Demonstrate some arbitrary width reasoning
example {x y z : BitVec w} :
(x &&& y) ||| (x &&& z) ||| (y &&& z) ||| x ||| y ||| z
=
~~~ ((~~~ x) &&& (~~~ y) &&& (~~~ z)) := by
ext i h
simp [h]
bv_decide
@[irreducible]
def ufBv (x : BitVec w) : BitVec w := x
example (x y : BitVec 16) : (ufBv x) + (ufBv y) = (ufBv y) + (ufBv x) := by bv_decide
@[irreducible]
def ufBool (x : Bool) : Bool := x
example (x y : BitVec 16) (z : Bool) : ((ufBool (x < y)) ∧ z) ↔ (z ∧ ufBool (x < y)) := by bv_decide
example (x y z : BitVec 16) (h1 : x < z) (h2 : z < (ufBv y)) : x < (ufBv y) := by bv_decide