Documentation
Projects
.
Util
.
Int
Search
return to top
source
Imports
Init
Projects.Util.Function
Projects.Util.Nat
Mathlib.Data.Int.Bitwise
Imported by
Int
.
instHOr_projects
Int
.
instHAnd_projects
Int
.
instHXor_projects
Int
.
even_iff_exi
Int
.
odd_iff_exi
Int
.
mod_2_ind
Int
.
not_even_mul_2_succ
Int
.
not_odd_mul_2
Int
.
le_one_iff
Int
.
of_between_succ
Int
.
add_div_eq
Int
.
negSucc_succ
Int
.
even_succ_iff
Int
.
odd_succ_iff
Int
.
succ_div_2_eq_div_iff
Int
.
succ_div_2_eq_div_succ_iff
Int
.
succ_div_2_eq_or_eq
Int
.
succ_div_2_eq_div_iff'
Int
.
succ_div_2_eq_div_succ_iff'
Int
.
mul_2_succ_div_2_eq
Int
.
max_abs_eq_zero_iff
Int
.
eq_self_sub_iff
Int
.
toNat_eq_self_of
Int
.
zero_land
Int
.
lit_neg_land_lit_pos
Int
.
testBit_ofNat
Int
.
testBit_natCast
Int
.
testBit_negSucc
Int
.
ext_testBit
Int
.
ext_testBit_iff
Int
.
testBit_lor'
Int
.
testBit_land'
Int
.
testBit_lxor'
Int
.
lxor_land
Int
.
lxor_eq_left_iff
Int
.
lxor_eq_right_iff
Int
.
testBit_neg_ofNat_succ
Int
.
testBit_succ_zero
Int
.
cases_pos_neg
Int
.
testBit_neg_natCast_succ
Int
.
succ_eq_lor
Int
.
lor_eq_succ
Int
.
land_lnot_succ_eq_zero_iff
Int
.
lor_comm
Int
.
land_comm
Int
.
xor_comm
Int
.
lor_lor_self
Int
.
land_one_ne_zero_iff
Int
.
land_one_ne_one_iff
Int
.
xor_land
Int
.
land_lnot_succ_land_one_eq_one_iff
Int
.
ofNat_eq_natCast'
Int
.
testBit_shiftRight_natCast
Int
.
testBit_shiftRight_nat_lit
Int
.
testBit_natCast_succ
Int
.
negSucc_succ_add_one
Int
.
testBit_succ_one
Int
.
lnot_zero
Int
.
lor_self
Int
.
land_self
Int
.
xor_self
Int
.
neg_one_lor
Int
.
lor_neg_one
Int
.
neg_one_land
Int
.
land_neg_one
Int
.
land_one_eq_zero_iff
Int
.
land_one_eq_one_iff'
Int
.
land_two_eq_zero_iff
Int
.
land_two_eq_two_iff
Int
.
shiftRight_natCast_left
Int
.
shiftRight_nat_lit
Int
.
neg_one_shiftRight_nat
Int
.
natCast_shiftRight_self
Int
.
nat_lit_shiftRight_self
Int
.
testBit_mul_two_succ
Int
.
testBit_neg_natCast_mul_two_succ
Int
.
testBit_neg_nat_lit_mul_two_succ
Int
.
mul_two_shiftRight_nat_succ
Int
.
testBit_shiftRight_nat_add_one
Int
.
testBit_natCast_add_natCast_lit
Int
.
testBit_natCast_add_nat_lit
Int
.
testBit_neg_one_sub_natCast
Int
.
lor_one_add_one_succ
Int
.
even_negSucc_iff
Int
.
odd_negSucc_iff
Int
.
even_iff_testBit
Int
.
odd_iff_testBit
source
@[instance_reducible]
instance
Int
.
instHOr_projects
:
HOr
ℤ
ℤ
ℤ
Equations
Int.instHOr_projects
=
{
hOr
:=
Int.lor
}
source
@[instance_reducible]
instance
Int
.
instHAnd_projects
:
HAnd
ℤ
ℤ
ℤ
Equations
Int.instHAnd_projects
=
{
hAnd
:=
Int.land
}
source
@[instance_reducible]
instance
Int
.
instHXor_projects
:
HXor
ℤ
ℤ
ℤ
Equations
Int.instHXor_projects
=
{
hXor
:=
Int.xor
}
source
theorem
Int
.
even_iff_exi
{
n
:
ℤ
}
:
Even
n
↔
∃ (
k
:
ℤ
),
n
=
k
*
2
source
theorem
Int
.
odd_iff_exi
{
n
:
ℤ
}
:
Odd
n
↔
∃ (
k
:
ℤ
),
n
=
k
*
2
+
1
source
theorem
Int
.
mod_2_ind
{
P
:
ℤ
→
Prop
}
(
h₁
:
∀ (
n
:
ℤ
),
P
(
n
*
2
)
)
(
h₂
:
∀ (
n
:
ℤ
),
P
(
n
*
2
+
1
)
)
(
n
:
ℤ
)
:
P
n
source
theorem
Int
.
not_even_mul_2_succ
{
n
:
ℤ
}
:
¬
Even
(
n
*
2
+
1
)
source
@[simp]
theorem
Int
.
not_odd_mul_2
{
n
:
ℤ
}
:
¬
Odd
(
n
*
2
)
source
theorem
Int
.
le_one_iff
{
n
:
ℤ
}
(
h
:
0
≤
n
)
:
n
≤
1
↔
n
=
0
∨
n
=
1
source
theorem
Int
.
of_between_succ
{
a
b
:
ℤ
}
(
h₁
:
a
≤
b
)
(
h₂
:
b
≤
a
+
1
)
:
b
=
a
∨
b
=
a
+
1
source
theorem
Int
.
add_div_eq
{
a
b
:
ℤ
}
(
h
:
0
<
b
)
:
(
a
+
b
)
/
b
=
a
/
b
+
1
source
theorem
Int
.
negSucc_succ
{
n
:
ℕ
}
:
negSucc
(
n
+
1
)
=
negSucc
n
-
1
source
@[simp]
theorem
Int
.
even_succ_iff
{
n
:
ℤ
}
:
Even
(
n
+
1
)
↔
Odd
n
source
@[simp]
theorem
Int
.
odd_succ_iff
{
n
:
ℤ
}
:
Odd
(
n
+
1
)
↔
Even
n
source
theorem
Int
.
succ_div_2_eq_div_iff
{
n
:
ℤ
}
(
hp
:
0
≤
n
)
:
(
n
+
1
)
/
2
=
n
/
2
↔
Even
n
source
theorem
Int
.
succ_div_2_eq_div_succ_iff
{
n
:
ℤ
}
(
hp
:
0
≤
n
)
:
(
n
+
1
)
/
2
=
n
/
2
+
1
↔
Odd
n
source
theorem
Int
.
succ_div_2_eq_or_eq
{
n
:
ℤ
}
(
hp
:
0
≤
n
)
:
(
n
+
1
)
/
2
=
n
/
2
∨
(
n
+
1
)
/
2
=
n
/
2
+
1
source
theorem
Int
.
succ_div_2_eq_div_iff'
{
n
:
ℤ
}
(
hp
:
0
≤
n
)
:
n
/
2
=
(
n
+
1
)
/
2
↔
Even
n
source
@[simp]
theorem
Int
.
succ_div_2_eq_div_succ_iff'
{
n
:
ℤ
}
(
hp
:
0
≤
n
)
:
n
/
2
+
1
=
(
n
+
1
)
/
2
↔
Odd
n
source
theorem
Int
.
mul_2_succ_div_2_eq
{
n
:
ℤ
}
(
hp
:
0
≤
n
)
:
(
n
*
2
+
1
)
/
2
=
n
source
@[simp]
theorem
Int
.
max_abs_eq_zero_iff
{
n
m
:
ℤ
}
:
max
|
n
|
|
m
|
=
0
↔
n
=
0
∧
m
=
0
source
@[simp]
theorem
Int
.
eq_self_sub_iff
{
a
b
:
ℤ
}
:
a
=
a
-
b
↔
b
=
0
source
theorem
Int
.
toNat_eq_self_of
{
z
:
ℤ
}
(
h₁
:
0
≤
z
)
:
↑
z
.
toNat
=
z
source
@[simp]
theorem
Int
.
zero_land
{
n
:
ℤ
}
:
0
&&&
n
=
0
source
@[simp]
theorem
Int
.
lit_neg_land_lit_pos
{
n
m
:
ℕ
}
:
-
OfNat.ofNat
(
n
+
1
)
&&&
OfNat.ofNat
m
=
↑
(
m
.
ldiff
n
)
source
@[simp]
theorem
Int
.
testBit_ofNat
{
n
i
:
ℕ
}
:
(
OfNat.ofNat
n
)
.
testBit
i
=
n
.
testBit
i
source
@[simp]
theorem
Int
.
testBit_natCast
{
n
i
:
ℕ
}
:
(↑
n
)
.
testBit
i
=
n
.
testBit
i
source
@[simp]
theorem
Int
.
testBit_negSucc
{
n
i
:
ℕ
}
:
(
negSucc
n
)
.
testBit
i
=
!
n
.
testBit
i
source
theorem
Int
.
ext_testBit
{
n
m
:
ℤ
}
(
h
:
∀ (
i
:
ℕ
),
n
.
testBit
i
=
m
.
testBit
i
)
:
n
=
m
source
theorem
Int
.
ext_testBit_iff
{
n
m
:
ℤ
}
:
n
=
m
↔
∀ (
i
:
ℕ
),
n
.
testBit
i
=
m
.
testBit
i
source
@[simp]
theorem
Int
.
testBit_lor'
{
n
m
:
ℤ
}
{
i
:
ℕ
}
:
(
n
|||
m
).
testBit
i
=
(
n
.
testBit
i
||
m
.
testBit
i
)
source
@[simp]
theorem
Int
.
testBit_land'
{
n
m
:
ℤ
}
{
i
:
ℕ
}
:
(
n
&&&
m
).
testBit
i
=
(
n
.
testBit
i
&&
m
.
testBit
i
)
source
@[simp]
theorem
Int
.
testBit_lxor'
{
n
m
:
ℤ
}
{
i
:
ℕ
}
:
(
n
^^^
m
).
testBit
i
=
(
n
.
testBit
i
^^
m
.
testBit
i
)
source
theorem
Int
.
lxor_land
{
n
m
k
:
ℤ
}
:
(
n
^^^
m
)
&&&
k
=
n
&&&
k
^^^
m
&&&
k
source
@[simp]
theorem
Int
.
lxor_eq_left_iff
{
n
m
:
ℤ
}
:
n
^^^
m
=
n
↔
m
=
0
source
@[simp]
theorem
Int
.
lxor_eq_right_iff
{
n
m
:
ℤ
}
:
n
^^^
m
=
m
↔
n
=
0
source
@[simp]
theorem
Int
.
testBit_neg_ofNat_succ
{
n
i
:
ℕ
}
:
(
-
OfNat.ofNat
(
n
+
1
)
).
testBit
i
=
!
n
.
testBit
i
source
@[simp]
theorem
Int
.
testBit_succ_zero
{
n
:
ℤ
}
:
(
n
+
1
).
testBit
0
=
!
n
.
testBit
0
source
theorem
Int
.
cases_pos_neg
{
p
:
ℤ
→
Prop
}
(
h₁
:
∀ (
n
:
ℕ
),
p
↑
n
)
(
h₂
:
∀ (
n
:
ℕ
),
p
(
-
↑
n
)
)
(
n
:
ℤ
)
:
p
n
source
theorem
Int
.
testBit_neg_natCast_succ
{
n
i
:
ℕ
}
:
(
-
↑(
n
+
1
)
).
testBit
i
=
!
n
.
testBit
i
source
theorem
Int
.
succ_eq_lor
{
n
:
ℤ
}
(
h
:
n
.
testBit
0
=
false
)
:
n
+
1
=
n
|||
1
source
theorem
Int
.
lor_eq_succ
{
n
:
ℤ
}
(
h
:
n
.
testBit
0
=
false
)
:
n
|||
1
=
n
+
1
source
@[simp]
theorem
Int
.
land_lnot_succ_eq_zero_iff
{
n
:
ℤ
}
:
n
&&&
(
n
+
1
).
lnot
=
0
↔
n
&&&
1
=
0
source
theorem
Int
.
lor_comm
{
n
m
:
ℤ
}
:
n
|||
m
=
m
|||
n
source
theorem
Int
.
land_comm
{
n
m
:
ℤ
}
:
n
&&&
m
=
m
&&&
n
source
theorem
Int
.
xor_comm
{
n
m
:
ℤ
}
:
n
^^^
m
=
m
^^^
n
source
theorem
Int
.
lor_lor_self
{
n
m
:
ℤ
}
:
n
|||
m
|||
n
=
n
|||
m
source
@[simp]
theorem
Int
.
land_one_ne_zero_iff
{
n
:
ℤ
}
:
n
&&&
1
≠
0
↔
n
&&&
1
=
1
source
@[simp]
theorem
Int
.
land_one_ne_one_iff
{
n
:
ℤ
}
:
n
&&&
1
≠
1
↔
n
&&&
1
=
0
source
theorem
Int
.
xor_land
{
n
m
k
:
ℤ
}
:
(
n
^^^
m
)
&&&
k
=
n
&&&
k
^^^
m
&&&
k
source
@[simp]
theorem
Int
.
land_lnot_succ_land_one_eq_one_iff
{
n
:
ℤ
}
:
n
&&&
(
n
+
1
).
lnot
&&&
1
=
1
↔
n
&&&
1
=
1
source
theorem
Int
.
ofNat_eq_natCast'
{
n
:
ℕ
}
:
OfNat.ofNat
n
=
↑
n
source
@[simp]
theorem
Int
.
testBit_shiftRight_natCast
{
n
:
ℤ
}
{
m
i
:
ℕ
}
:
(
n
>>>
m
).
testBit
i
=
n
.
testBit
(
m
+
i
)
source
@[simp]
theorem
Int
.
testBit_shiftRight_nat_lit
{
n
:
ℤ
}
{
m
i
:
ℕ
}
:
(
n
>>>
OfNat.ofNat
m
).
testBit
i
=
n
.
testBit
(
m
+
i
)
source
@[simp]
theorem
Int
.
testBit_natCast_succ
{
n
:
ℕ
}
:
(
↑
n
+
1
).
testBit
=
(
n
+
1
).
testBit
source
@[simp]
theorem
Int
.
negSucc_succ_add_one
{
n
:
ℕ
}
:
negSucc
(
n
+
1
)
+
1
=
negSucc
n
source
@[simp]
theorem
Int
.
testBit_succ_one
{
n
:
ℤ
}
:
(
n
+
1
).
testBit
1
=
(
n
.
testBit
0
^^
n
.
testBit
1
)
source
@[simp]
theorem
Int
.
lnot_zero
:
lnot
0
=
-
1
source
@[simp]
theorem
Int
.
lor_self
{
n
:
ℤ
}
:
n
|||
n
=
n
source
@[simp]
theorem
Int
.
land_self
{
n
:
ℤ
}
:
n
&&&
n
=
n
source
@[simp]
theorem
Int
.
xor_self
{
n
:
ℤ
}
:
n
^^^
n
=
0
source
@[simp]
theorem
Int
.
neg_one_lor
{
n
:
ℤ
}
:
-
1
|||
n
=
-
1
source
@[simp]
theorem
Int
.
lor_neg_one
{
n
:
ℤ
}
:
n
|||
-
1
=
-
1
source
@[simp]
theorem
Int
.
neg_one_land
{
n
:
ℤ
}
:
-
1
&&&
n
=
n
source
@[simp]
theorem
Int
.
land_neg_one
{
n
:
ℤ
}
:
n
&&&
-
1
=
n
source
theorem
Int
.
land_one_eq_zero_iff
{
n
:
ℤ
}
:
n
&&&
1
=
0
↔
n
.
testBit
0
=
false
source
theorem
Int
.
land_one_eq_one_iff'
{
n
:
ℤ
}
:
n
&&&
1
=
1
↔
n
.
testBit
0
=
true
source
theorem
Int
.
land_two_eq_zero_iff
{
n
:
ℤ
}
:
n
&&&
2
=
0
↔
n
.
testBit
1
=
false
source
theorem
Int
.
land_two_eq_two_iff
{
n
:
ℤ
}
:
n
&&&
2
=
2
↔
n
.
testBit
1
=
true
source
theorem
Int
.
shiftRight_natCast_left
{
n
m
:
ℕ
}
:
↑
n
>>>
m
=
↑(
n
>>>
m
)
source
@[simp]
theorem
Int
.
shiftRight_nat_lit
{
n
:
ℤ
}
{
m
:
ℕ
}
:
n
>>>
OfNat.ofNat
m
=
n
>>>
m
source
@[simp]
theorem
Int
.
neg_one_shiftRight_nat
{
n
:
ℕ
}
:
(-
1
)
>>>
n
=
-
1
source
@[simp]
theorem
Int
.
natCast_shiftRight_self
{
n
:
ℕ
}
:
↑
n
>>>
n
=
0
source
@[simp]
theorem
Int
.
nat_lit_shiftRight_self
{
n
:
ℕ
}
:
OfNat.ofNat
n
>>>
n
=
0
source
@[simp]
theorem
Int
.
testBit_mul_two_succ
{
n
:
ℤ
}
{
i
:
ℕ
}
:
(
n
*
2
).
testBit
(
i
+
1
)
=
n
.
testBit
i
source
@[simp]
theorem
Int
.
testBit_neg_natCast_mul_two_succ
{
n
i
:
ℕ
}
:
(
-
(
↑
n
*
2
)).
testBit
(
i
+
1
)
=
(
-
↑
n
).
testBit
i
source
@[simp]
theorem
Int
.
testBit_neg_nat_lit_mul_two_succ
{
n
i
:
ℕ
}
:
(
-
(
OfNat.ofNat
n
*
2
)).
testBit
(
i
+
1
)
=
(
-
OfNat.ofNat
n
).
testBit
i
source
@[simp]
theorem
Int
.
mul_two_shiftRight_nat_succ
{
n
:
ℤ
}
{
i
:
ℕ
}
:
(
n
*
2
)
>>>
(
i
+
1
)
=
n
>>>
i
source
theorem
Int
.
testBit_shiftRight_nat_add_one
{
n
:
ℤ
}
{
i
:
ℕ
}
:
(
n
>>>
1
+
1
).
testBit
i
=
(
n
+
2
).
testBit
(
i
+
1
)
source
@[simp]
theorem
Int
.
testBit_natCast_add_natCast_lit
{
n
m
:
ℕ
}
:
(
↑
n
+
↑
m
).
testBit
=
(
n
+
m
).
testBit
source
@[simp]
theorem
Int
.
testBit_natCast_add_nat_lit
{
n
m
:
ℕ
}
:
(
↑
n
+
OfNat.ofNat
m
).
testBit
=
(
n
+
m
).
testBit
source
@[simp]
theorem
Int
.
testBit_neg_one_sub_natCast
{
n
i
:
ℕ
}
:
(
-
1
+
-
↑
n
).
testBit
i
=
!
n
.
testBit
i
source
@[simp]
theorem
Int
.
lor_one_add_one_succ
{
n
:
ℤ
}
{
i
:
ℕ
}
:
((
n
|||
1
)
+
1
).
testBit
(
i
+
1
)
=
(
n
+
2
).
testBit
(
i
+
1
)
source
@[simp]
theorem
Int
.
even_negSucc_iff
{
n
:
ℕ
}
:
Even
(
negSucc
n
)
↔
Odd
n
source
@[simp]
theorem
Int
.
odd_negSucc_iff
{
n
:
ℕ
}
:
Odd
(
negSucc
n
)
↔
Even
n
source
theorem
Int
.
even_iff_testBit
{
n
:
ℤ
}
:
Even
n
↔
n
.
testBit
0
=
false
source
theorem
Int
.
odd_iff_testBit
{
n
:
ℤ
}
:
Odd
n
↔
n
.
testBit
0
=
true