Documentation

Std.Tactic.BVDecide.Normalize.BitVec

This module contains the BitVec simplifying part of the bv_normalize simp set.

theorem Std.Tactic.BVDecide.Normalize.BitVec.slt_eq_ult {w : Nat} (x y : BitVec w) :
x.slt y = (!x.getLsbD (w - 1) == y.getLsbD (w - 1) ^^ x.ult y)
theorem Std.Tactic.BVDecide.Normalize.BitVec.sle_eq_ult {w : Nat} (x y : BitVec w) :
x.sle y = !(!x.getLsbD (w - 1) == y.getLsbD (w - 1) ^^ y.ult x)
theorem Std.Tactic.BVDecide.Normalize.BitVec.sdiv_udiv {w : Nat} (x y : BitVec w) :
x.sdiv y = bif x.getLsbD (w - 1) then bif y.getLsbD (w - 1) then -x / -y else -(-x / y) else bif y.getLsbD (w - 1) then -(x / -y) else x / y
theorem Std.Tactic.BVDecide.Normalize.BitVec.smod_umod {w : Nat} (x y : BitVec w) :
x.smod y = bif x.getLsbD (w - 1) then bif y.getLsbD (w - 1) then -(-x % -y) else bif -x % y == 0#w then -x % y else y - -x % y else bif y.getLsbD (w - 1) then bif x % -y == 0#w then x % -y else x % -y + y else x.umod y
theorem Std.Tactic.BVDecide.Normalize.BitVec.smtSDiv_smtUDiv {w : Nat} (x y : BitVec w) :
x.smtSDiv y = bif x.getLsbD (w - 1) then bif y.getLsbD (w - 1) then (-x).smtUDiv (-y) else -(-x).smtUDiv y else bif y.getLsbD (w - 1) then -x.smtUDiv (-y) else x.smtUDiv y
theorem Std.Tactic.BVDecide.Normalize.BitVec.srem_umod {w : Nat} (x y : BitVec w) :
x.srem y = bif x.getLsbD (w - 1) then bif y.getLsbD (w - 1) then -(-x % -y) else -(-x % y) else bif y.getLsbD (w - 1) then x % -y else x % y
theorem Std.Tactic.BVDecide.Normalize.BitVec.abs_eq {w : Nat} (x : BitVec w) :
x.abs = bif x.getLsbD (w - 1) then -x else x
theorem Std.Tactic.BVDecide.Normalize.BitVec.neg_mul {w : Nat} (x y : BitVec w) :
(~~~x + 1#w) * y = ~~~(x * y) + 1#w
theorem Std.Tactic.BVDecide.Normalize.BitVec.mul_neg {w : Nat} (x y : BitVec w) :
x * (~~~y + 1#w) = ~~~(x * y) + 1#w
theorem Std.Tactic.BVDecide.Normalize.BitVec.shiftLeft_neg {w₁ w₂ : Nat} {x : BitVec w₁} {y : BitVec w₂} :
(~~~x + 1#w₁) <<< y = ~~~(x <<< y) + 1
theorem Std.Tactic.BVDecide.Normalize.BitVec.lt_one_iff {n : Nat} (a : BitVec n) (h : 0 < n) :
a.ult 1#n = (a == 0#n)
theorem Std.Tactic.BVDecide.Normalize.BitVec.udiv_ofNat_eq_of_lt (w : Nat) (x : BitVec w) (n k : Nat) (hk : 2 ^ k = n) (hlt : k < w) :
x / BitVec.ofNat w n = x >>> k

x / (BitVec.ofNat n) where n = 2^k is the same as shifting x right by k.

theorem Std.Tactic.BVDecide.Normalize.BitVec.exctractLsb'_if {w : Nat} {c : Bool} {x y : BitVec w} (s l : Nat) :
BitVec.extractLsb' s l (bif c then x else y) = bif c then BitVec.extractLsb' s l x else BitVec.extractLsb' s l y
theorem Std.Tactic.BVDecide.Normalize.BitVec.signExtend_elim {v : Nat} {x : BitVec v} {w : Nat} (h : v w) :
BitVec.signExtend w x = BitVec.cast ((bif x.msb then -1#(w - v) else 0#(w - v)) ++ x)
theorem Std.Tactic.BVDecide.Normalize.BitVec.mul_beq_mul_short_circuit_left {w : Nat} {x₁ x₂ y : BitVec w} :
(x₁ * y == x₂ * y) = !(!x₁ == x₂ && !x₁ * y == x₂ * y)
theorem Std.Tactic.BVDecide.Normalize.BitVec.mul_beq_mul_short_circuit_right {w : Nat} {x y₁ y₂ : BitVec w} :
(x * y₁ == x * y₂) = !(!y₁ == y₂ && !x * y₁ == x * y₂)
theorem Std.Tactic.BVDecide.Normalize.UInt8.toBitVec_cond {c : Bool} {t e : UInt8} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec
theorem Std.Tactic.BVDecide.Normalize.UInt16.toBitVec_cond {c : Bool} {t e : UInt16} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec
theorem Std.Tactic.BVDecide.Normalize.UInt32.toBitVec_cond {c : Bool} {t e : UInt32} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec
theorem Std.Tactic.BVDecide.Normalize.UInt64.toBitVec_cond {c : Bool} {t e : UInt64} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec
theorem Std.Tactic.BVDecide.Normalize.USize.toBitVec_cond {c : Bool} {t e : USize} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec
theorem Std.Tactic.BVDecide.Normalize.Int8.toBitVec_cond {c : Bool} {t e : Int8} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec
theorem Std.Tactic.BVDecide.Normalize.Int16.toBitVec_cond {c : Bool} {t e : Int16} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec
theorem Std.Tactic.BVDecide.Normalize.Int32.toBitVec_cond {c : Bool} {t e : Int32} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec
theorem Std.Tactic.BVDecide.Normalize.Int64.toBitVec_cond {c : Bool} {t e : Int64} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec
theorem Std.Tactic.BVDecide.Normalize.ISize.toBitVec_cond {c : Bool} {t e : ISize} :
(bif c then t else e).toBitVec = bif c then t.toBitVec else e.toBitVec