Metamath Proof Explorer


Theorem sadasslem

Description: Lemma for sadass . (Contributed by Mario Carneiro, 9-Sep-2016)

Ref Expression
Hypotheses sadasslem.1 φ A 0
sadasslem.2 φ B 0
sadasslem.3 φ C 0
sadasslem.4 φ N 0
Assertion sadasslem φ A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N

Proof

Step Hyp Ref Expression
1 sadasslem.1 φ A 0
2 sadasslem.2 φ B 0
3 sadasslem.3 φ C 0
4 sadasslem.4 φ N 0
5 inss1 A 0 ..^ N A
6 5 1 sstrid φ A 0 ..^ N 0
7 fzofi 0 ..^ N Fin
8 7 a1i φ 0 ..^ N Fin
9 inss2 A 0 ..^ N 0 ..^ N
10 ssfi 0 ..^ N Fin A 0 ..^ N 0 ..^ N A 0 ..^ N Fin
11 8 9 10 sylancl φ A 0 ..^ N Fin
12 elfpw A 0 ..^ N 𝒫 0 Fin A 0 ..^ N 0 A 0 ..^ N Fin
13 6 11 12 sylanbrc φ A 0 ..^ N 𝒫 0 Fin
14 bitsf1o bits 0 : 0 1-1 onto 𝒫 0 Fin
15 f1ocnv bits 0 : 0 1-1 onto 𝒫 0 Fin bits 0 -1 : 𝒫 0 Fin 1-1 onto 0
16 f1of bits 0 -1 : 𝒫 0 Fin 1-1 onto 0 bits 0 -1 : 𝒫 0 Fin 0
17 14 15 16 mp2b bits 0 -1 : 𝒫 0 Fin 0
18 17 ffvelrni A 0 ..^ N 𝒫 0 Fin bits 0 -1 A 0 ..^ N 0
19 13 18 syl φ bits 0 -1 A 0 ..^ N 0
20 19 nn0cnd φ bits 0 -1 A 0 ..^ N
21 inss1 B 0 ..^ N B
22 21 2 sstrid φ B 0 ..^ N 0
23 inss2 B 0 ..^ N 0 ..^ N
24 ssfi 0 ..^ N Fin B 0 ..^ N 0 ..^ N B 0 ..^ N Fin
25 8 23 24 sylancl φ B 0 ..^ N Fin
26 elfpw B 0 ..^ N 𝒫 0 Fin B 0 ..^ N 0 B 0 ..^ N Fin
27 22 25 26 sylanbrc φ B 0 ..^ N 𝒫 0 Fin
28 17 ffvelrni B 0 ..^ N 𝒫 0 Fin bits 0 -1 B 0 ..^ N 0
29 27 28 syl φ bits 0 -1 B 0 ..^ N 0
30 29 nn0cnd φ bits 0 -1 B 0 ..^ N
31 inss1 C 0 ..^ N C
32 31 3 sstrid φ C 0 ..^ N 0
33 inss2 C 0 ..^ N 0 ..^ N
34 ssfi 0 ..^ N Fin C 0 ..^ N 0 ..^ N C 0 ..^ N Fin
35 8 33 34 sylancl φ C 0 ..^ N Fin
36 elfpw C 0 ..^ N 𝒫 0 Fin C 0 ..^ N 0 C 0 ..^ N Fin
37 32 35 36 sylanbrc φ C 0 ..^ N 𝒫 0 Fin
38 17 ffvelrni C 0 ..^ N 𝒫 0 Fin bits 0 -1 C 0 ..^ N 0
39 37 38 syl φ bits 0 -1 C 0 ..^ N 0
40 39 nn0cnd φ bits 0 -1 C 0 ..^ N
41 20 30 40 addassd φ bits 0 -1 A 0 ..^ N + bits 0 -1 B 0 ..^ N + bits 0 -1 C 0 ..^ N = bits 0 -1 A 0 ..^ N + bits 0 -1 B 0 ..^ N + bits 0 -1 C 0 ..^ N
42 41 oveq1d φ bits 0 -1 A 0 ..^ N + bits 0 -1 B 0 ..^ N + bits 0 -1 C 0 ..^ N mod 2 N = bits 0 -1 A 0 ..^ N + bits 0 -1 B 0 ..^ N + bits 0 -1 C 0 ..^ N mod 2 N
43 inss1 A sadd B 0 ..^ N A sadd B
44 sadcl A 0 B 0 A sadd B 0
45 1 2 44 syl2anc φ A sadd B 0
46 43 45 sstrid φ A sadd B 0 ..^ N 0
47 inss2 A sadd B 0 ..^ N 0 ..^ N
48 ssfi 0 ..^ N Fin A sadd B 0 ..^ N 0 ..^ N A sadd B 0 ..^ N Fin
49 8 47 48 sylancl φ A sadd B 0 ..^ N Fin
50 elfpw A sadd B 0 ..^ N 𝒫 0 Fin A sadd B 0 ..^ N 0 A sadd B 0 ..^ N Fin
51 46 49 50 sylanbrc φ A sadd B 0 ..^ N 𝒫 0 Fin
52 17 ffvelrni A sadd B 0 ..^ N 𝒫 0 Fin bits 0 -1 A sadd B 0 ..^ N 0
53 51 52 syl φ bits 0 -1 A sadd B 0 ..^ N 0
54 53 nn0red φ bits 0 -1 A sadd B 0 ..^ N
55 19 nn0red φ bits 0 -1 A 0 ..^ N
56 29 nn0red φ bits 0 -1 B 0 ..^ N
57 55 56 readdcld φ bits 0 -1 A 0 ..^ N + bits 0 -1 B 0 ..^ N
58 39 nn0red φ bits 0 -1 C 0 ..^ N
59 2rp 2 +
60 59 a1i φ 2 +
61 4 nn0zd φ N
62 60 61 rpexpcld φ 2 N +
63 eqid seq 0 c 2 𝑜 , m 0 if cadd m A m B c 1 𝑜 n 0 if n = 0 n 1 = seq 0 c 2 𝑜 , m 0 if cadd m A m B c 1 𝑜 n 0 if n = 0 n 1
64 eqid bits 0 -1 = bits 0 -1
65 1 2 63 4 64 sadadd3 φ bits 0 -1 A sadd B 0 ..^ N mod 2 N = bits 0 -1 A 0 ..^ N + bits 0 -1 B 0 ..^ N mod 2 N
66 eqidd φ bits 0 -1 C 0 ..^ N mod 2 N = bits 0 -1 C 0 ..^ N mod 2 N
67 54 57 58 58 62 65 66 modadd12d φ bits 0 -1 A sadd B 0 ..^ N + bits 0 -1 C 0 ..^ N mod 2 N = bits 0 -1 A 0 ..^ N + bits 0 -1 B 0 ..^ N + bits 0 -1 C 0 ..^ N mod 2 N
68 inss1 B sadd C 0 ..^ N B sadd C
69 sadcl B 0 C 0 B sadd C 0
70 2 3 69 syl2anc φ B sadd C 0
71 68 70 sstrid φ B sadd C 0 ..^ N 0
72 inss2 B sadd C 0 ..^ N 0 ..^ N
73 ssfi 0 ..^ N Fin B sadd C 0 ..^ N 0 ..^ N B sadd C 0 ..^ N Fin
74 8 72 73 sylancl φ B sadd C 0 ..^ N Fin
75 elfpw B sadd C 0 ..^ N 𝒫 0 Fin B sadd C 0 ..^ N 0 B sadd C 0 ..^ N Fin
76 71 74 75 sylanbrc φ B sadd C 0 ..^ N 𝒫 0 Fin
77 17 ffvelrni B sadd C 0 ..^ N 𝒫 0 Fin bits 0 -1 B sadd C 0 ..^ N 0
78 76 77 syl φ bits 0 -1 B sadd C 0 ..^ N 0
79 78 nn0red φ bits 0 -1 B sadd C 0 ..^ N
80 56 58 readdcld φ bits 0 -1 B 0 ..^ N + bits 0 -1 C 0 ..^ N
81 eqidd φ bits 0 -1 A 0 ..^ N mod 2 N = bits 0 -1 A 0 ..^ N mod 2 N
82 eqid seq 0 c 2 𝑜 , m 0 if cadd m B m C c 1 𝑜 n 0 if n = 0 n 1 = seq 0 c 2 𝑜 , m 0 if cadd m B m C c 1 𝑜 n 0 if n = 0 n 1
83 2 3 82 4 64 sadadd3 φ bits 0 -1 B sadd C 0 ..^ N mod 2 N = bits 0 -1 B 0 ..^ N + bits 0 -1 C 0 ..^ N mod 2 N
84 55 55 79 80 62 81 83 modadd12d φ bits 0 -1 A 0 ..^ N + bits 0 -1 B sadd C 0 ..^ N mod 2 N = bits 0 -1 A 0 ..^ N + bits 0 -1 B 0 ..^ N + bits 0 -1 C 0 ..^ N mod 2 N
85 42 67 84 3eqtr4d φ bits 0 -1 A sadd B 0 ..^ N + bits 0 -1 C 0 ..^ N mod 2 N = bits 0 -1 A 0 ..^ N + bits 0 -1 B sadd C 0 ..^ N mod 2 N
86 eqid seq 0 c 2 𝑜 , m 0 if cadd m A sadd B m C c 1 𝑜 n 0 if n = 0 n 1 = seq 0 c 2 𝑜 , m 0 if cadd m A sadd B m C c 1 𝑜 n 0 if n = 0 n 1
87 45 3 86 4 64 sadadd3 φ bits 0 -1 A sadd B sadd C 0 ..^ N mod 2 N = bits 0 -1 A sadd B 0 ..^ N + bits 0 -1 C 0 ..^ N mod 2 N
88 eqid seq 0 c 2 𝑜 , m 0 if cadd m A m B sadd C c 1 𝑜 n 0 if n = 0 n 1 = seq 0 c 2 𝑜 , m 0 if cadd m A m B sadd C c 1 𝑜 n 0 if n = 0 n 1
89 1 70 88 4 64 sadadd3 φ bits 0 -1 A sadd B sadd C 0 ..^ N mod 2 N = bits 0 -1 A 0 ..^ N + bits 0 -1 B sadd C 0 ..^ N mod 2 N
90 85 87 89 3eqtr4d φ bits 0 -1 A sadd B sadd C 0 ..^ N mod 2 N = bits 0 -1 A sadd B sadd C 0 ..^ N mod 2 N
91 inss1 A sadd B sadd C 0 ..^ N A sadd B sadd C
92 sadcl A sadd B 0 C 0 A sadd B sadd C 0
93 45 3 92 syl2anc φ A sadd B sadd C 0
94 91 93 sstrid φ A sadd B sadd C 0 ..^ N 0
95 inss2 A sadd B sadd C 0 ..^ N 0 ..^ N
96 ssfi 0 ..^ N Fin A sadd B sadd C 0 ..^ N 0 ..^ N A sadd B sadd C 0 ..^ N Fin
97 8 95 96 sylancl φ A sadd B sadd C 0 ..^ N Fin
98 elfpw A sadd B sadd C 0 ..^ N 𝒫 0 Fin A sadd B sadd C 0 ..^ N 0 A sadd B sadd C 0 ..^ N Fin
99 94 97 98 sylanbrc φ A sadd B sadd C 0 ..^ N 𝒫 0 Fin
100 17 ffvelrni A sadd B sadd C 0 ..^ N 𝒫 0 Fin bits 0 -1 A sadd B sadd C 0 ..^ N 0
101 99 100 syl φ bits 0 -1 A sadd B sadd C 0 ..^ N 0
102 101 nn0red φ bits 0 -1 A sadd B sadd C 0 ..^ N
103 101 nn0ge0d φ 0 bits 0 -1 A sadd B sadd C 0 ..^ N
104 101 fvresd φ bits 0 bits 0 -1 A sadd B sadd C 0 ..^ N = bits bits 0 -1 A sadd B sadd C 0 ..^ N
105 f1ocnvfv2 bits 0 : 0 1-1 onto 𝒫 0 Fin A sadd B sadd C 0 ..^ N 𝒫 0 Fin bits 0 bits 0 -1 A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N
106 14 99 105 sylancr φ bits 0 bits 0 -1 A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N
107 104 106 eqtr3d φ bits bits 0 -1 A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N
108 107 95 eqsstrdi φ bits bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ N
109 101 nn0zd φ bits 0 -1 A sadd B sadd C 0 ..^ N
110 bitsfzo bits 0 -1 A sadd B sadd C 0 ..^ N N 0 bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ 2 N bits bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ N
111 109 4 110 syl2anc φ bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ 2 N bits bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ N
112 108 111 mpbird φ bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ 2 N
113 elfzolt2 bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ 2 N bits 0 -1 A sadd B sadd C 0 ..^ N < 2 N
114 112 113 syl φ bits 0 -1 A sadd B sadd C 0 ..^ N < 2 N
115 modid bits 0 -1 A sadd B sadd C 0 ..^ N 2 N + 0 bits 0 -1 A sadd B sadd C 0 ..^ N bits 0 -1 A sadd B sadd C 0 ..^ N < 2 N bits 0 -1 A sadd B sadd C 0 ..^ N mod 2 N = bits 0 -1 A sadd B sadd C 0 ..^ N
116 102 62 103 114 115 syl22anc φ bits 0 -1 A sadd B sadd C 0 ..^ N mod 2 N = bits 0 -1 A sadd B sadd C 0 ..^ N
117 inss1 A sadd B sadd C 0 ..^ N A sadd B sadd C
118 sadcl A 0 B sadd C 0 A sadd B sadd C 0
119 1 70 118 syl2anc φ A sadd B sadd C 0
120 117 119 sstrid φ A sadd B sadd C 0 ..^ N 0
121 inss2 A sadd B sadd C 0 ..^ N 0 ..^ N
122 ssfi 0 ..^ N Fin A sadd B sadd C 0 ..^ N 0 ..^ N A sadd B sadd C 0 ..^ N Fin
123 8 121 122 sylancl φ A sadd B sadd C 0 ..^ N Fin
124 elfpw A sadd B sadd C 0 ..^ N 𝒫 0 Fin A sadd B sadd C 0 ..^ N 0 A sadd B sadd C 0 ..^ N Fin
125 120 123 124 sylanbrc φ A sadd B sadd C 0 ..^ N 𝒫 0 Fin
126 17 ffvelrni A sadd B sadd C 0 ..^ N 𝒫 0 Fin bits 0 -1 A sadd B sadd C 0 ..^ N 0
127 125 126 syl φ bits 0 -1 A sadd B sadd C 0 ..^ N 0
128 127 nn0red φ bits 0 -1 A sadd B sadd C 0 ..^ N
129 2nn 2
130 129 a1i φ 2
131 130 4 nnexpcld φ 2 N
132 131 nnrpd φ 2 N +
133 127 nn0ge0d φ 0 bits 0 -1 A sadd B sadd C 0 ..^ N
134 127 fvresd φ bits 0 bits 0 -1 A sadd B sadd C 0 ..^ N = bits bits 0 -1 A sadd B sadd C 0 ..^ N
135 f1ocnvfv2 bits 0 : 0 1-1 onto 𝒫 0 Fin A sadd B sadd C 0 ..^ N 𝒫 0 Fin bits 0 bits 0 -1 A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N
136 14 125 135 sylancr φ bits 0 bits 0 -1 A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N
137 134 136 eqtr3d φ bits bits 0 -1 A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N
138 137 121 eqsstrdi φ bits bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ N
139 127 nn0zd φ bits 0 -1 A sadd B sadd C 0 ..^ N
140 bitsfzo bits 0 -1 A sadd B sadd C 0 ..^ N N 0 bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ 2 N bits bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ N
141 139 4 140 syl2anc φ bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ 2 N bits bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ N
142 138 141 mpbird φ bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ 2 N
143 elfzolt2 bits 0 -1 A sadd B sadd C 0 ..^ N 0 ..^ 2 N bits 0 -1 A sadd B sadd C 0 ..^ N < 2 N
144 142 143 syl φ bits 0 -1 A sadd B sadd C 0 ..^ N < 2 N
145 modid bits 0 -1 A sadd B sadd C 0 ..^ N 2 N + 0 bits 0 -1 A sadd B sadd C 0 ..^ N bits 0 -1 A sadd B sadd C 0 ..^ N < 2 N bits 0 -1 A sadd B sadd C 0 ..^ N mod 2 N = bits 0 -1 A sadd B sadd C 0 ..^ N
146 128 132 133 144 145 syl22anc φ bits 0 -1 A sadd B sadd C 0 ..^ N mod 2 N = bits 0 -1 A sadd B sadd C 0 ..^ N
147 90 116 146 3eqtr3d φ bits 0 -1 A sadd B sadd C 0 ..^ N = bits 0 -1 A sadd B sadd C 0 ..^ N
148 f1of1 bits 0 -1 : 𝒫 0 Fin 1-1 onto 0 bits 0 -1 : 𝒫 0 Fin 1-1 0
149 14 15 148 mp2b bits 0 -1 : 𝒫 0 Fin 1-1 0
150 f1fveq bits 0 -1 : 𝒫 0 Fin 1-1 0 A sadd B sadd C 0 ..^ N 𝒫 0 Fin A sadd B sadd C 0 ..^ N 𝒫 0 Fin bits 0 -1 A sadd B sadd C 0 ..^ N = bits 0 -1 A sadd B sadd C 0 ..^ N A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N
151 149 150 mpan A sadd B sadd C 0 ..^ N 𝒫 0 Fin A sadd B sadd C 0 ..^ N 𝒫 0 Fin bits 0 -1 A sadd B sadd C 0 ..^ N = bits 0 -1 A sadd B sadd C 0 ..^ N A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N
152 99 125 151 syl2anc φ bits 0 -1 A sadd B sadd C 0 ..^ N = bits 0 -1 A sadd B sadd C 0 ..^ N A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N
153 147 152 mpbid φ A sadd B sadd C 0 ..^ N = A sadd B sadd C 0 ..^ N