|
50 | 50 | (counter-constant IS_DATA))) |
51 | 51 |
|
52 | 52 | (defconstraint special-ct-constancy () |
53 | | - (if-not-zero (+ (- 1 PHASE_5) (- 1 DEPTH_1) IS_PREFIX (- 1 IS_DATA)) |
| 53 | + (if-not-zero (+ (- 1 [PHASE 5]) (- 1 DEPTH_1) IS_PREFIX (- 1 IS_DATA)) |
54 | 54 | (counter-constant [INPUT 1]))) |
55 | 55 |
|
56 | 56 | (defconstraint ct-incrementing () |
|
59 | 59 | (counter-incrementing LC_CORRECTION))) |
60 | 60 |
|
61 | 61 | (defconstraint phase5-incrementing () |
62 | | - (phase-incrementing PHASE_5 DEPTH_1)) |
| 62 | + (phase-incrementing [PHASE 5] DEPTH_1)) |
63 | 63 |
|
64 | 64 | (defconstraint is-topic-incrementing () |
65 | 65 | (phase-incrementing IS_TOPIC INDEX_LOCAL)) |
66 | 66 |
|
67 | 67 | (defconstraint phase1-constant () |
68 | | - (phase-constancy PHASE_1 TXRCPT_SIZE)) |
| 68 | + (phase-constancy [PHASE 1] TXRCPT_SIZE)) |
69 | 69 |
|
70 | 70 | ;; 4.1.2 Global Phase Constraints ;; |
71 | 71 | (defconstraint impose-phase-id () |
72 | 72 | (eq! PHASE_ID |
73 | | - (+ (* 1 PHASE_1) |
74 | | - (* 2 PHASE_2) |
75 | | - (* 3 PHASE_3) |
76 | | - (* 5 PHASE_5) |
| 73 | + (+ (* 1 [PHASE 1]) |
| 74 | + (* 2 [PHASE 2]) |
| 75 | + (* 3 [PHASE 3]) |
| 76 | + (* 5 [PHASE 5]) |
77 | 77 | (* SUBPHASE_ID_WEIGHT_IS_PREFIX IS_PREFIX) |
78 | 78 | (* SUBPHASE_ID_WEIGHT_IS_OT IS_TOPIC) |
79 | 79 | (* SUBPHASE_ID_WEIGHT_IS_OD IS_DATA) |
|
84 | 84 | (begin (vanishes! ABS_TX_NUM) |
85 | 85 | (vanishes! ABS_LOG_NUM))) |
86 | 86 |
|
87 | | -(defun (phase-sum) (+ PHASE_1 PHASE_2 PHASE_3 PHASE_5)) |
| 87 | +(defun (phase-sum) (+ [PHASE 1] [PHASE 2] [PHASE 3] [PHASE 5])) |
88 | 88 |
|
89 | 89 | (defconstraint phase-exclusion () |
90 | 90 | (if-zero ABS_TX_NUM |
91 | 91 | (vanishes! (phase-sum)) |
92 | 92 | (eq! 1 (phase-sum)))) |
93 | 93 |
|
94 | 94 | (defconstraint ABS_TX_NUM-evolution () |
95 | | - (if (or! (eq! PHASE_1 0) (remained-constant! PHASE_1)) |
| 95 | + (if (or! (eq! [PHASE 1] 0) (remained-constant! [PHASE 1])) |
96 | 96 | ;; no change |
97 | 97 | (remained-constant! ABS_TX_NUM) |
98 | 98 | ;; increment |
99 | 99 | (did-inc! ABS_TX_NUM 1))) |
100 | 100 |
|
101 | 101 | (defconstraint ABS_LOG_NUM-evolution () |
102 | | - (if-zero (+ (- 1 PHASE_5) (- 1 DEPTH_1) (- 1 IS_PREFIX) IS_TOPIC IS_DATA CT) |
| 102 | + (if-zero (+ (- 1 [PHASE 5]) (- 1 DEPTH_1) (- 1 IS_PREFIX) IS_TOPIC IS_DATA CT) |
103 | 103 | (did-inc! ABS_LOG_NUM 1) |
104 | 104 | (remained-constant! ABS_LOG_NUM))) |
105 | 105 |
|
|
111 | 111 | (if-not-zero PHASE_SIZE |
112 | 112 | (vanishes! PHASE_END))) |
113 | 113 |
|
114 | | -(defun (phase-wght-sum) (+ PHASE_1 |
115 | | - (* 2 PHASE_2) |
116 | | - (* 3 PHASE_3) |
117 | | - (* 5 PHASE_5))) |
| 114 | +(defun (phase-wght-sum) (+ [PHASE 1] |
| 115 | + (* 2 [PHASE 2]) |
| 116 | + (* 3 [PHASE 3]) |
| 117 | + (* 5 [PHASE 5]))) |
118 | 118 |
|
119 | 119 | (defconstraint no-end-no-change-phase (:guard ABS_TX_NUM) |
120 | 120 | (if-zero PHASE_END |
121 | 121 | (eq! (phase-wght-sum) |
122 | | - (+ (next PHASE_1) |
123 | | - (* 2 (next PHASE_2)) |
124 | | - (* 3 (next PHASE_3)) |
125 | | - (* 5 (next PHASE_5)))))) |
| 122 | + (+ (next [PHASE 1]) |
| 123 | + (* 2 (next [PHASE 2])) |
| 124 | + (* 3 (next [PHASE 3])) |
| 125 | + (* 5 (next [PHASE 5])))))) |
126 | 126 |
|
127 | 127 | (defconstraint phase-transition () |
128 | 128 | (if-eq PHASE_END 1 |
129 | 129 | (begin (eq! 1 |
130 | | - (+ (* PHASE_1 (next PHASE_2)) |
131 | | - (* PHASE_2 (next PHASE_3)) |
132 | | - (* PHASE_3 (next PHASE_5)) |
133 | | - (* PHASE_5 (next PHASE_1)))) |
134 | | - (if-eq PHASE_5 1 (vanishes! TXRCPT_SIZE))))) |
| 130 | + (+ (* [PHASE 1] (next [PHASE 2])) |
| 131 | + (* [PHASE 2] (next [PHASE 3])) |
| 132 | + (* [PHASE 3] (next [PHASE 5])) |
| 133 | + (* [PHASE 5] (next [PHASE 1])))) |
| 134 | + (if-eq [PHASE 5] 1 (vanishes! TXRCPT_SIZE))))) |
135 | 135 |
|
136 | 136 | ;; 4.1.3 Byte decomposition's loop heartbeat ;; |
137 | 137 | (defconstraint ct-imply-done (:guard ABS_TX_NUM) |
|
166 | 166 |
|
167 | 167 | ;; 4.1.6 Byte size updates ;; |
168 | 168 | (defconstraint globalsize-update () |
169 | | - (if-zero PHASE_1 |
| 169 | + (if-zero [PHASE 1] |
170 | 170 | (eq! TXRCPT_SIZE |
171 | 171 | (- (prev TXRCPT_SIZE) (* LC nBYTES))))) |
172 | 172 |
|
173 | 173 | (defconstraint phase-size-update () |
174 | | - (if-eq 1 (* PHASE_5 DEPTH_1) |
| 174 | + (if-eq 1 (* [PHASE 5] DEPTH_1) |
175 | 175 | (eq! PHASE_SIZE |
176 | 176 | (- (prev PHASE_SIZE) (* LC nBYTES))))) |
177 | 177 |
|
178 | 178 | ;; LC correction nullity ;; |
179 | 179 | (defconstraint lc-correction-nullity () |
180 | | - (if-zero (+ PHASE_1 (* PHASE_5 IS_DATA)) |
| 180 | + (if-zero (+ [PHASE 1] (* [PHASE 5] IS_DATA)) |
181 | 181 | (vanishes! LC_CORRECTION))) |
182 | 182 |
|
183 | 183 | ;; 4.1.8 Finalization Constraints ;; |
184 | 184 | (defconstraint finalization (:domain {-1}) |
185 | 185 | (if-not-zero ABS_TX_NUM |
186 | 186 | (begin (eq! PHASE_END 1) |
187 | | - (eq! PHASE_5 1) |
| 187 | + (eq! [PHASE 5] 1) |
188 | 188 | (eq! ABS_TX_NUM ABS_TX_NUM_MAX) |
189 | 189 | (eq! ABS_LOG_NUM ABS_LOG_NUM_MAX)))) |
190 | 190 |
|
|
194 | 194 | ;; ;; |
195 | 195 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
196 | 196 | ;; 4.2.1 Phase 1 : RLP prefix ;; |
197 | | -(defconstraint phase1-init (:guard PHASE_1);; 4.1.1 |
198 | | - (if-zero (prev PHASE_1) |
| 197 | +(defconstraint phase1-init (:guard [PHASE 1]);; 4.1.1 |
| 198 | + (if-zero (prev [PHASE 1]) |
199 | 199 | (begin (vanishes! (+ (- 1 IS_PREFIX) PHASE_END (next IS_PREFIX))) |
200 | 200 | (eq! nSTEP 1) |
201 | 201 | (if-zero [INPUT 1] |
|
205 | 205 | (* [INPUT 1] (^ 256 LLARGEMO))) |
206 | 206 | (eq! nBYTES 1)))))) |
207 | 207 |
|
208 | | -(defconstraint phase1-rlprefix (:guard PHASE_1) |
| 208 | +(defconstraint phase1-rlprefix (:guard [PHASE 1]) |
209 | 209 | (if-zero IS_PREFIX |
210 | 210 | (begin (eq! nSTEP 8) |
211 | 211 | (vanishes! LC_CORRECTION) |
212 | 212 | (eq! [INPUT 1] TXRCPT_SIZE) |
213 | | - (rlpPrefixOfByteString [INPUT 1] CT nSTEP DONE PHASE_1 ACC_SIZE POWER BIT [ACC 1] [ACC 2] LC LIMB nBYTES) |
| 213 | + (rlpPrefixOfByteString [INPUT 1] CT nSTEP DONE [PHASE 1] ACC_SIZE POWER BIT [ACC 1] [ACC 2] LC LIMB nBYTES) |
214 | 214 | (if-eq DONE 1 (eq! PHASE_END 1))))) |
215 | 215 |
|
216 | 216 | ;; 4.2.2 Phase 2 : status code Rz ;; |
217 | 217 | (defconstraint phase2 () |
218 | | - (if-eq PHASE_2 1 |
| 218 | + (if-eq [PHASE 2] 1 |
219 | 219 | (begin (eq! nSTEP 1) |
220 | 220 | (if-zero [INPUT 1] |
221 | 221 | (eq! LIMB |
|
227 | 227 |
|
228 | 228 | ;; 4.2.3 Phase 3 : cumulative gas Ru ;; |
229 | 229 | (defconstraint phase3 () |
230 | | - (if-eq PHASE_3 1 |
| 230 | + (if-eq [PHASE 3] 1 |
231 | 231 | (begin (eq! nSTEP 8) |
232 | 232 | (rlpPrefixInt [INPUT 1] CT nSTEP DONE [BYTE 1] [ACC 1] ACC_SIZE POWER BIT BIT_ACC LIMB LC nBYTES) |
233 | 233 | (if-eq DONE 1 |
234 | 234 | (begin (limbShifting [INPUT 1] POWER ACC_SIZE LIMB nBYTES) |
235 | 235 | (eq! PHASE_END 1)))))) |
236 | 236 |
|
237 | 237 | ;; Phase 5: log series Rl ;; |
238 | | -(defconstraint phase5-init (:guard PHASE_5) |
239 | | - (if-zero (prev PHASE_5) |
| 238 | +(defconstraint phase5-init (:guard [PHASE 5]) |
| 239 | + (if-zero (prev [PHASE 5]) |
240 | 240 | (vanishes! (+ DEPTH_1 (- 1 IS_PREFIX) IS_TOPIC IS_DATA)))) |
241 | 241 |
|
242 | | -(defconstraint phase5-phaseRlpPrefix (:guard PHASE_5) |
| 242 | +(defconstraint phase5-phaseRlpPrefix (:guard [PHASE 5]) |
243 | 243 | (if-zero DEPTH_1 |
244 | 244 | (begin (eq! [INPUT 1] PHASE_SIZE) |
245 | 245 | (if-zero [INPUT 1] |
|
249 | 249 | (eq! nBYTES 1) |
250 | 250 | (eq! PHASE_END 1)) |
251 | 251 | (begin (eq! nSTEP 8) |
252 | | - (rlpPrefixOfByteString [INPUT 1] CT nSTEP DONE PHASE_5 ACC_SIZE POWER BIT [ACC 1] [ACC 2] LC LIMB nBYTES) |
| 252 | + (rlpPrefixOfByteString [INPUT 1] CT nSTEP DONE [PHASE 5] ACC_SIZE POWER BIT [ACC 1] [ACC 2] LC LIMB nBYTES) |
253 | 253 | (if-eq DONE 1 |
254 | 254 | (vanishes! (+ (- 1 (next DEPTH_1)) |
255 | 255 | (- 1 (next IS_PREFIX)) |
256 | 256 | (next IS_TOPIC) |
257 | 257 | (next IS_DATA))))))))) |
258 | 258 |
|
259 | | -(defconstraint phase5-logentryRlpPrefix (:guard PHASE_5) |
| 259 | +(defconstraint phase5-logentryRlpPrefix (:guard [PHASE 5]) |
260 | 260 | (if-eq 1 (* DEPTH_1 IS_PREFIX (- 1 IS_TOPIC) (- 1 IS_DATA)) |
261 | 261 | (begin (eq! [INPUT 1] LOG_ENTRY_SIZE) |
262 | 262 | (eq! nSTEP 8) |
263 | | - (rlpPrefixOfByteString [INPUT 1] CT nSTEP DONE PHASE_5 ACC_SIZE POWER BIT [ACC 1] [ACC 2] LC LIMB nBYTES) |
| 263 | + (rlpPrefixOfByteString [INPUT 1] CT nSTEP DONE [PHASE 5] ACC_SIZE POWER BIT [ACC 1] [ACC 2] LC LIMB nBYTES) |
264 | 264 | (if-eq DONE 1 |
265 | 265 | (vanishes! (+ (next IS_PREFIX) (next IS_TOPIC) (next IS_DATA))))))) |
266 | 266 |
|
267 | | -(defconstraint phase5-rlpAddress (:guard PHASE_5) |
| 267 | +(defconstraint phase5-rlpAddress (:guard [PHASE 5]) |
268 | 268 | (if-zero (+ IS_PREFIX IS_TOPIC IS_DATA) |
269 | 269 | (begin (eq! nSTEP 3) |
270 | 270 | (eq! LC 1) |
|
281 | 281 | (- 1 (next IS_TOPIC)) |
282 | 282 | (next IS_DATA)))))))) |
283 | 283 |
|
284 | | -(defconstraint phase5-topic-prefix (:guard PHASE_5) |
| 284 | +(defconstraint phase5-topic-prefix (:guard [PHASE 5]) |
285 | 285 | (if-eq (* IS_PREFIX IS_TOPIC) 1 |
286 | 286 | (begin (vanishes! INDEX_LOCAL) |
287 | 287 | (eq! nSTEP 1) |
|
306 | 306 | (- 1 (next IS_TOPIC)) |
307 | 307 | (next IS_DATA)))))))) |
308 | 308 |
|
309 | | -(defconstraint phase5-topic (:guard PHASE_5) |
| 309 | +(defconstraint phase5-topic (:guard [PHASE 5]) |
310 | 310 | (if-zero (+ IS_PREFIX (- 1 IS_TOPIC)) |
311 | 311 | (begin (eq! nSTEP 3) |
312 | 312 | (eq! LC 1) |
|
330 | 330 | (- 1 (next IS_TOPIC)) |
331 | 331 | (next IS_DATA))))))))) |
332 | 332 |
|
333 | | -(defconstraint phase5-dataprefix (:guard PHASE_5) |
| 333 | +(defconstraint phase5-dataprefix (:guard [PHASE 5]) |
334 | 334 | (if-eq (* IS_PREFIX IS_DATA) 1 |
335 | 335 | (begin (eq! [INPUT 1] LOCAL_SIZE) |
336 | 336 | (if-zero LOCAL_SIZE |
|
372 | 372 | CT |
373 | 373 | nSTEP |
374 | 374 | DONE |
375 | | - PHASE_1 |
| 375 | + [PHASE 1] |
376 | 376 | ACC_SIZE |
377 | 377 | POWER |
378 | 378 | BIT |
|
386 | 386 | (next IS_TOPIC) |
387 | 387 | (- 1 (next IS_DATA)))))))))) |
388 | 388 |
|
389 | | -(defconstraint phase5-data (:guard PHASE_5) |
| 389 | +(defconstraint phase5-data (:guard [PHASE 5]) |
390 | 390 | (if-zero (+ IS_PREFIX (- 1 IS_DATA)) |
391 | 391 | (begin (eq! INDEX_LOCAL CT) |
392 | 392 | (eq! LC 1) |
|
401 | 401 | (next IS_TOPIC) |
402 | 402 | (next IS_DATA))))))))) |
403 | 403 |
|
404 | | -(defconstraint phase5-logEntrySize-update (:guard PHASE_5) |
| 404 | +(defconstraint phase5-logEntrySize-update (:guard [PHASE 5]) |
405 | 405 | (if-zero (+ (- 1 DEPTH_1) |
406 | 406 | (* IS_PREFIX (- 1 IS_TOPIC) (- 1 IS_DATA))) |
407 | 407 | (eq! LOG_ENTRY_SIZE |
408 | 408 | (- (prev LOG_ENTRY_SIZE) (* LC nBYTES))))) |
409 | 409 |
|
410 | | -(defconstraint phase5-localsize-update (:guard PHASE_5) |
| 410 | +(defconstraint phase5-localsize-update (:guard [PHASE 5]) |
411 | 411 | (if-zero (+ IS_PREFIX |
412 | 412 | (- 1 (+ IS_TOPIC IS_DATA))) |
413 | 413 | (eq! LOCAL_SIZE |
|
0 commit comments