Metamath Proof Explorer


Theorem zofldiv2

Description: The floor of an odd integer divided by 2 is equal to the integer first decreased by 1 and then divided by 2. (Contributed by AV, 7-Jun-2020)

Ref Expression
Assertion zofldiv2 N N + 1 2 N 2 = N 1 2

Proof

Step Hyp Ref Expression
1 zcn N N
2 npcan1 N N - 1 + 1 = N
3 2 eqcomd N N = N - 1 + 1
4 1 3 syl N N = N - 1 + 1
5 4 oveq1d N N 2 = N - 1 + 1 2
6 peano2zm N N 1
7 6 zcnd N N 1
8 1cnd N 1
9 2cnne0 2 2 0
10 9 a1i N 2 2 0
11 divdir N 1 1 2 2 0 N - 1 + 1 2 = N 1 2 + 1 2
12 7 8 10 11 syl3anc N N - 1 + 1 2 = N 1 2 + 1 2
13 5 12 eqtrd N N 2 = N 1 2 + 1 2
14 13 fveq2d N N 2 = N 1 2 + 1 2
15 14 adantr N N + 1 2 N 2 = N 1 2 + 1 2
16 halfge0 0 1 2
17 halflt1 1 2 < 1
18 16 17 pm3.2i 0 1 2 1 2 < 1
19 zob N N + 1 2 N 1 2
20 19 biimpa N N + 1 2 N 1 2
21 halfre 1 2
22 flbi2 N 1 2 1 2 N 1 2 + 1 2 = N 1 2 0 1 2 1 2 < 1
23 20 21 22 sylancl N N + 1 2 N 1 2 + 1 2 = N 1 2 0 1 2 1 2 < 1
24 18 23 mpbiri N N + 1 2 N 1 2 + 1 2 = N 1 2
25 15 24 eqtrd N N + 1 2 N 2 = N 1 2