Documentation

SSA.Projects.InstCombine.ForLean

theorem Nat.eq_one_mod_two_of_ne_zero (n : ) (h : (n % 2 != 0) = true) :
n % 2 = 1
theorem Nat.sub_mod_of_lt (n : ) (x : ) (hxgt0 : x > 0) (hxltn : x < n) :
(n - x) % n = n - x
theorem Nat.two_pow_pred_sub_two_pow {w : } (h : 0 < w) :
2 ^ (w - 1) - 2 ^ w = -2 ^ (w - 1)
@[simp]
theorem Nat.one_mod_two_pow_eq {n : } (hn : n 0) :
1 % 2 ^ n = 1
theorem Nat.cases_of_lt_mod_add {a : } {b : } {m : } {k : } (hsum : (a + b) % m < k) (ha : a < m) (hb : b < m) :
a + b < m a + b < k a + b m a + b < m + k
theorem Nat.mod_eq_if {a : } {b : } :
a % b = if 0 a a < b then a else if b a a < 2 * b then a - b else a % b
@[simp]
theorem Nat.mod_two_pow_mod_two (x : ) (w : ) :
0 < wx % 2 ^ w % 2 = x % 2
theorem Nat.two_le_add_iff_odd_and_odd (n : ) (m : ) :
2 n % 2 + m % 2 n % 2 = 1 m % 2 = 1
theorem Nat.add_odd_iff_neq (n : ) (m : ) :
(n + m) % 2 = 1 (n % 2 = 1) (m % 2 = 1)
theorem Nat.mod_eq_of_eq {a : } {b : } {c : } (h : a = b) :
a % c = b % c
@[simp]
theorem BitVec.abs_eq_add_xor {w : } {x : BitVec w} :
let_fun y := BitVec.cast (BitVec.replicate w (BitVec.ofBool x.msb)); x.abs = x + y ^^^ y
theorem BitVec.abs_eq_if {w : } {x : BitVec w} :
x.abs = if x.msb = true then -x else x
@[simp]
theorem BitVec.toNat_shiftLeft' {w : } (A : BitVec w) (B : BitVec w) :
(A <<< B).toNat = A.toNat * 2 ^ B.toNat % 2 ^ w
theorem BitVec.one_shiftLeft_mul_eq_shiftLeft {w : } {A : BitVec w} {B : BitVec w} :
1 <<< B * A = A <<< B
@[simp]
def BitVec.msb_one {w : } (h : 1 < w) :
(1#w).msb = false
Equations
  • =
Instances For
    @[simp]
    def BitVec.msb_allOnes {w : } (h : 0 < w) :
    Equations
    • =
    Instances For
      Equations
      • =
      Instances For
        theorem BitVec.udiv_one_eq_self (w : ) (x : BitVec w) :
        x.udiv 1#w = x
        theorem BitVec.udiv_eq_zero_iff {w : } {x : BitVec w} {y : BitVec w} (h : 0#w < y) :
        x.udiv y = 0#w x < y
        @[simp]
        theorem BitVec.udiv_eq_zero {w : } {x : BitVec w} {y : BitVec w} (h : x < y) :
        x.udiv y = 0#w
        def BitVec.sdiv_one_allOnes {w : } (h : 1 < w) :
        Equations
        • =
        Instances For
          theorem BitVec.width_one_cases (a : BitVec 1) :
          a = 0#1 a = 1#1
          theorem BitVec.sub_eq_add_neg {w : } {x : BitVec w} {y : BitVec w} :
          x - y = x + -y
          theorem BitVec.toNat_neq_of_neq_ofNat {w : } {a : BitVec w} {n : } (h : a BitVec.ofNat w n) :
          a.toNat n
          theorem BitVec.gt_one_of_neq_0_neq_1 {w : } (a : BitVec w) (ha0 : a 0) (ha1 : a 1) :
          a > 1
          def BitVec.one_sdiv {w : } {a : BitVec w} (ha0 : a 0) (ha1 : a 1) (hao : a BitVec.allOnes w) :
          (1#w).sdiv a = 0#w
          Equations
          • =
          Instances For
            def BitVec.sdiv_one_one {w : } :
            (1#w).sdiv 1#w = 1#w
            Equations
            • =
            Instances For
              theorem BitVec.toNat_neq_zero_of_neq_zero {w : } {x : BitVec w} (hx : x 0) :
              x.toNat 0
              theorem BitVec.eq_zero_of_toNat_mod_eq_zero {w : } {x : BitVec w} (hx : x.toNat % 2 ^ w = 0) :
              x = 0
              theorem BitVec.intMin_eq_one {w : } (hw : w 1) :
              theorem BitVec.intMin_neq_one {w : } (h : w > 1) :
              theorem BitVec.width_one_cases' (x : BitVec 1) :
              x = 0 x = 1
              theorem BitVec.ult_toNat {n : } (x : BitVec n) (y : BitVec n) :
              (y >ᵤ x) = decide (x.toNat < y.toNat)
              theorem BitVec.getLsb_geX {w : } {i : } (x : BitVec w) (hi : i w) :
              x.getLsbD i = false
              theorem BitVec.intMin_slt_zero {w : } (h : 0 < w) :
              theorem BitVec.neg_sgt_eq_slt_neg {w : } {A : BitVec w} {B : BitVec w} (h : A BitVec.intMin w) (h2 : B BitVec.intMin w) :
              (-A >ₛ B) = (-B >ₛ A)
              theorem BitVec.sgt_zero_eq_not_neg_sgt_zero {w : } (A : BitVec w) (h_ne_intMin : A BitVec.intMin w) (h_ne_zero : A 0) :
              (A >ₛ 0#w) = true ¬(-A >ₛ 0#w) = true
              theorem BitVec.sgt_same {w : } (A : BitVec w) :
              ¬(A >ₛ A) = true
              theorem BitVec.zero_sub_eq_neg {w : } {A : BitVec w} :
              BitVec.ofInt w 0 - A = -A
              @[simp]
              theorem BitVec.toInt_width_zero (x : BitVec 0) :
              x.toInt = 0
              @[simp]
              theorem BitVec.neg_of_ofNat_0_minus_self {w : } (x : BitVec w) :
              0#w - x = -x
              @[simp]
              theorem BitVec.carry_and_xor_false {i : } :
              ∀ {w : } {a b : BitVec w}, BitVec.carry i (a &&& b) (a ^^^ b) false = false
              @[simp]
              theorem BitVec.and_add_xor_eq_or {w : } {a : BitVec w} {b : BitVec w} :
              (a &&& b) + (a ^^^ b) = a ||| b
              @[simp]
              @[simp]
              theorem BitVec.and_add_or {w : } {A : BitVec w} {B : BitVec w} :
              (B &&& A) + (B ||| A) = B + A
              @[simp]
              theorem BitVec.msb_signExtend_of_ge {w : } {i : } (h : i w) (x : BitVec w) :
              (BitVec.signExtend i x).msb = x.msb
              theorem BitVec.signExtend_succ {w : } (i : ) (x : BitVec w) :
              BitVec.signExtend (i + 1) x = BitVec.cons (if i < w then x.getLsbD i else x.msb) (BitVec.signExtend i x)
              @[simp]
              theorem BitVec.one_shiftLeft_mul {w : } {x : BitVec w} {y : BitVec w} :
              1#w <<< x.toNat * y = y <<< x.toNat
              @[simp]
              theorem BitVec.mul_allOnes {w : } {x : BitVec w} :
              @[simp]
              theorem BitVec.allOnes_sshiftRight {w : } {n : } :
              (BitVec.allOnes w).sshiftRight n = BitVec.allOnes w
              @[simp]
              theorem BitVec.zero_sshiftRight {w : } {n : } :
              (0#w).sshiftRight n = 0#w
              @[simp]
              theorem BitVec.zero_ushiftRight {w : } {n : } :
              0#w >>> n = 0#w
              theorem BitVec.ofInt_neg_one {w : } :
              BitVec.ofInt w (-1) = -1#w
              @[simp]
              theorem BitVec.shiftLeft_and_distrib' {w : } {x : BitVec w} {y : BitVec w} {n : } {m : } :
              x <<< n &&& y <<< (m + n) = (x &&& y <<< m) <<< n
              @[simp]
              theorem BitVec.zero_sub {w : } {x : BitVec w} :
              0#w - x = -x
              theorem BitVec.getLsbD_sub {w : } {i : } {i_lt : i < w} {x : BitVec w} {y : BitVec w} :
              (x - y).getLsbD i = (x.getLsbD i ^^ ((~~~y + 1).getLsbD i ^^ BitVec.carry i x (~~~y + 1) false))
              theorem BitVec.getMsbD_add {w : } {i : } {i_lt : i < w} {x : BitVec w} {y : BitVec w} :
              (x + y).getMsbD i = (x.getMsbD i ^^ (y.getMsbD i ^^ BitVec.carry (w - 1 - i) x y false))
              theorem BitVec.getMsbD_sub {w : } {i : } {i_lt : i < w} {x : BitVec w} {y : BitVec w} :
              (x - y).getMsbD i = (x.getMsbD i ^^ ((~~~y + 1).getMsbD i ^^ BitVec.carry (w - 1 - i) x (~~~y + 1) false))
              theorem BitVec.msb_add {w : } {x : BitVec w} {y : BitVec w} :
              (x + y).msb = (x.getMsbD 0 ^^ (y.getMsbD 0 ^^ BitVec.carry (w - 1) x y false))
              theorem BitVec.msb_sub {w : } {x : BitVec w} {y : BitVec w} :
              (x - y).msb = (x.getMsbD 0 ^^ ((~~~y + 1#w).getMsbD 0 ^^ BitVec.carry (w - 1 - 0) x (~~~y + 1#w) false))
              theorem BitVec.msb_neg {w : } {x : BitVec w} :
              (-x).msb = (~~~x + 1#w).msb
              theorem BitVec.getLsbD_neg {w : } {i : } {x : BitVec w} :
              (-x).getLsbD i = (~~~x + 1#w).getLsbD i
              theorem BitVec.getMsbD_neg {w : } {i : } {x : BitVec w} :
              (-x).getMsbD i = (~~~x + 1#w).getMsbD i
              theorem BitVec.getLsbD_abs {w : } {i : } {x : BitVec w} :
              x.abs.getLsbD i = (if x.msb = true then -x else x).getLsbD i
              theorem BitVec.getMsbD_abs {w : } {i : } {x : BitVec w} :
              x.abs.getMsbD i = (if x.msb = true then -x else x).getMsbD i
              theorem BitVec.msb_abs {w : } {x : BitVec w} :
              x.abs.msb = (if x.msb = true then -x else x).msb
              theorem Bool.xor_decide (p : Prop) (q : Prop) [dp : Decidable p] [Decidable q] :
              (decide p ^^ decide q) = decide (p q)
              @[simp]
              theorem Bool.xor_not_xor {a : Bool} {b : Bool} :
              (!(a ^^ b) ^^ b) = !a
              @[simp]
              theorem Bool.not_xor_and_self {a : Bool} {b : Bool} :
              (!(a ^^ b) && b) = (a && b)
              theorem Bool.xor_inv_left {a : Bool} {b : Bool} {c : Bool} :
              (a ^^ b) = c b = (a ^^ c)
              @[simp]
              theorem Bool.xor_ne_self {a : Bool} {b : Bool} :
              (a ^^ (!a) != b) = !b
              @[simp]
              theorem Bool.not_eq_and {a : Bool} {b : Bool} :
              ((!b) == (a && b)) = (!a && b)
              @[simp]
              theorem Bool.not_bne' {a : Bool} {b : Bool} :
              (!a != b) = (a == b)