Metamath Proof Explorer


Theorem fldivp1

Description: The difference between the floors of adjacent fractions is either 1 or 0. (Contributed by Mario Carneiro, 8-Mar-2014)

Ref Expression
Assertion fldivp1 MNM+1NMN=ifNM+110

Proof

Step Hyp Ref Expression
1 nnz NN
2 nnne0 NN0
3 peano2z MM+1
4 3 adantr MNM+1
5 dvdsval2 NN0M+1NM+1M+1N
6 1 2 4 5 syl2an23an MNNM+1M+1N
7 6 biimpa MNNM+1M+1N
8 flid M+1NM+1N=M+1N
9 7 8 syl MNNM+1M+1N=M+1N
10 nnm1nn0 NN10
11 10 nn0red NN1
12 10 nn0ge0d N0N1
13 nnre NN
14 nngt0 N0<N
15 divge0 N10N1N0<N0N1N
16 11 12 13 14 15 syl22anc N0N1N
17 16 ad2antlr MNNM+10N1N
18 13 ltm1d NN1<N
19 nncn NN
20 19 mulridd N N1=N
21 18 20 breqtrrd NN1< N1
22 1re 1
23 22 a1i N1
24 ltdivmul N11N0<NN1N<1N1< N1
25 11 23 13 14 24 syl112anc NN1N<1N1< N1
26 21 25 mpbird NN1N<1
27 26 ad2antlr MNNM+1N1N<1
28 nndivre N1NN1N
29 11 28 mpancom NN1N
30 29 ad2antlr MNNM+1N1N
31 flbi2 M+1NN1NM+1N+N1N=M+1N0N1NN1N<1
32 7 30 31 syl2anc MNNM+1M+1N+N1N=M+1N0N1NN1N<1
33 17 27 32 mpbir2and MNNM+1M+1N+N1N=M+1N
34 9 33 eqtr4d MNNM+1M+1N=M+1N+N1N
35 zcn MM
36 35 adantr MNM
37 ax-1cn 1
38 37 a1i MN1
39 19 adantl MNN
40 36 38 39 ppncand MNM+1+N1=M+N
41 40 oveq1d MNM+1+N1N=M+NN
42 4 zcnd MNM+1
43 subcl N1N1
44 19 37 43 sylancl NN1
45 44 adantl MNN1
46 2 adantl MNN0
47 42 45 39 46 divdird MNM+1+N1N=M+1N+N1N
48 41 47 eqtr3d MNM+NN=M+1N+N1N
49 36 39 39 46 divdird MNM+NN=MN+NN
50 48 49 eqtr3d MNM+1N+N1N=MN+NN
51 39 46 dividd MNNN=1
52 51 oveq2d MNMN+NN=MN+1
53 50 52 eqtrd MNM+1N+N1N=MN+1
54 53 fveq2d MNM+1N+N1N=MN+1
55 54 adantr MNNM+1M+1N+N1N=MN+1
56 zre MM
57 nndivre MNMN
58 56 57 sylan MNMN
59 1z 1
60 fladdz MN1MN+1=MN+1
61 58 59 60 sylancl MNMN+1=MN+1
62 61 adantr MNNM+1MN+1=MN+1
63 34 55 62 3eqtrrd MNNM+1MN+1=M+1N
64 zre M+1M+1
65 3 64 syl MM+1
66 nndivre M+1NM+1N
67 65 66 sylan MNM+1N
68 67 flcld MNM+1N
69 68 zcnd MNM+1N
70 58 flcld MNMN
71 70 zcnd MNMN
72 69 71 38 subaddd MNM+1NMN=1MN+1=M+1N
73 72 adantr MNNM+1M+1NMN=1MN+1=M+1N
74 63 73 mpbird MNNM+1M+1NMN=1
75 iftrue NM+1ifNM+110=1
76 75 adantl MNNM+1ifNM+110=1
77 74 76 eqtr4d MNNM+1M+1NMN=ifNM+110
78 zmodcl M+1NM+1modN0
79 3 78 sylan MNM+1modN0
80 79 nn0red MNM+1modN
81 resubcl M+1modN1M+1modN1
82 80 22 81 sylancl MNM+1modN1
83 82 adantr MN¬NM+1M+1modN1
84 elnn0 M+1modN0M+1modNM+1modN=0
85 79 84 sylib MNM+1modNM+1modN=0
86 85 ord MN¬M+1modNM+1modN=0
87 id NN
88 dvdsval3 NM+1NM+1M+1modN=0
89 87 3 88 syl2anr MNNM+1M+1modN=0
90 86 89 sylibrd MN¬M+1modNNM+1
91 90 con1d MN¬NM+1M+1modN
92 91 imp MN¬NM+1M+1modN
93 nnm1nn0 M+1modNM+1modN10
94 92 93 syl MN¬NM+1M+1modN10
95 94 nn0ge0d MN¬NM+10M+1modN1
96 13 14 jca NN0<N
97 96 ad2antlr MN¬NM+1N0<N
98 divge0 M+1modN10M+1modN1N0<N0M+1modN1N
99 83 95 97 98 syl21anc MN¬NM+10M+1modN1N
100 13 adantl MNN
101 80 ltm1d MNM+1modN1<M+1modN
102 nnrp NN+
103 modlt M+1N+M+1modN<N
104 65 102 103 syl2an MNM+1modN<N
105 82 80 100 101 104 lttrd MNM+1modN1<N
106 39 mulridd MN N1=N
107 105 106 breqtrrd MNM+1modN1< N1
108 22 a1i MN1
109 14 adantl MN0<N
110 ltdivmul M+1modN11N0<NM+1modN1N<1M+1modN1< N1
111 82 108 100 109 110 syl112anc MNM+1modN1N<1M+1modN1< N1
112 107 111 mpbird MNM+1modN1N<1
113 112 adantr MN¬NM+1M+1modN1N<1
114 nndivre M+1modN1NM+1modN1N
115 82 114 sylancom MNM+1modN1N
116 flbi2 M+1NM+1modN1NM+1N+M+1modN1N=M+1N0M+1modN1NM+1modN1N<1
117 68 115 116 syl2anc MNM+1N+M+1modN1N=M+1N0M+1modN1NM+1modN1N<1
118 117 adantr MN¬NM+1M+1N+M+1modN1N=M+1N0M+1modN1NM+1modN1N<1
119 99 113 118 mpbir2and MN¬NM+1M+1N+M+1modN1N=M+1N
120 modval M+1N+M+1modN=M+1-NM+1N
121 65 102 120 syl2an MNM+1modN=M+1-NM+1N
122 121 oveq1d MNM+1modN1=M+1-NM+1N-1
123 39 69 mulcld MNNM+1N
124 42 38 123 sub32d MNM+1-1-NM+1N=M+1-NM+1N-1
125 122 124 eqtr4d MNM+1modN1=M+1-1-NM+1N
126 pncan M1M+1-1=M
127 36 37 126 sylancl MNM+1-1=M
128 127 oveq1d MNM+1-1-NM+1N=MNM+1N
129 125 128 eqtrd MNM+1modN1=MNM+1N
130 129 oveq1d MNM+1modN1N=MNM+1NN
131 36 123 39 46 divsubdird MNMNM+1NN=MNNM+1NN
132 69 39 46 divcan3d MNNM+1NN=M+1N
133 132 oveq2d MNMNNM+1NN=MNM+1N
134 130 131 133 3eqtrrd MNMNM+1N=M+1modN1N
135 58 recnd MNMN
136 115 recnd MNM+1modN1N
137 135 69 136 subaddd MNMNM+1N=M+1modN1NM+1N+M+1modN1N=MN
138 134 137 mpbid MNM+1N+M+1modN1N=MN
139 138 adantr MN¬NM+1M+1N+M+1modN1N=MN
140 139 fveq2d MN¬NM+1M+1N+M+1modN1N=MN
141 119 140 eqtr3d MN¬NM+1M+1N=MN
142 69 71 subeq0ad MNM+1NMN=0M+1N=MN
143 142 adantr MN¬NM+1M+1NMN=0M+1N=MN
144 141 143 mpbird MN¬NM+1M+1NMN=0
145 iffalse ¬NM+1ifNM+110=0
146 145 adantl MN¬NM+1ifNM+110=0
147 144 146 eqtr4d MN¬NM+1M+1NMN=ifNM+110
148 77 147 pm2.61dan MNM+1NMN=ifNM+110