std:EVM/State/Layout/Laws

lib/EVM/State/Layout/Laws.omg

lib/EVM/State/Layout/Laws.omg606 lines
1{- Laws of the storage formulas of `std:EVM/State/Layout/Address`, checked by
2   the kernel. They are about the formulas over naturals; tests tie the
3   formulas to the access code. Arithmetic rests on the hypothesis
4   `std:Arith.NatFacts`, taken as an argument where a law needs it.
5
6   L1 `confinedWithin`, L2 `blockSeparate`, L3 `placeInjective` and
7   `placeBelow` (the entries of a list or a direct mapping never overlap
8   and lie in the extent that validity checks), L4 `addressInjective` (for
9   address keys; a record key's encoding is injective by the bit-field
10   algebra of `field` and `setField`, which is not proved here), L5
11   `appendCancel`, L6 `checkedAddSound` and `checkedAddComplete`.
12
13   Two assumptions are not provable and are stated here only:
14
15   A (both hashing policies, k = 256 under Solidity): for the preimages of an
16   execution history, the values `H x mod 2^k` lie at cyclic distance of at
17   least E slots from each other, E the largest hashed object. In the random
18   oracle model, keys chosen against the contract need about
19   2^((k - extentBits) / 2) hash evaluations to break it; validity puts
20   k - extentBits >= margin = 160.
21
22   A0 (Solidity only): no hashed object overlaps the root object. Placing
23   one there takes about 2^256 / (rootSlots + E) evaluations; validity puts
24   bitLength (rootSlots + E) + margin <= 256.
25-}
26let A = std:Arith
27let Address = std:EVM/State/Layout/Address
28let E = std:Equal
29let L = std:List
30let N = std:Natural
31let O = std:Optional
32let R = std:Region
33
34-- Every power of two is positive.
35let pow2Positive
36    : A.NatFacts -> forall (k : Natural) -> A.Lt 0 (N.pow2 k)
37    = \h k ->
38        Natural/elim
39          (\(j : Natural) -> A.Lt 0 (N.pow2 j))
40          (A.leRefl 1)
41          (\(j : Natural) (positive : A.Lt 0 (N.pow2 j)) ->
42             let double
43                 : 2 * N.pow2 j === N.pow2 j + N.pow2 j
44                 = E.trans
45                     (h.timesSucc 1 (N.pow2 j))
46                     (E.cong (\(x : Natural) -> x + N.pow2 j) (h.timesSucc 0 (N.pow2 j)))
47             in  A.leTransEq
48                   1
49                   (N.pow2 j + N.pow2 j)
50                   (2 * N.pow2 j)
51                   (A.leTrans
52                      1
53                      (N.pow2 j)
54                      (N.pow2 j + N.pow2 j)
55                      positive
56                      (A.lePlusRight (N.pow2 j) (N.pow2 j)))
57                   (E.sym double))
58          k
59
60-- L1: a confined slot lies in its block.
61let confinedWithin
62    : A.NatFacts
63      -> forall (start bits hash offset : Natural)
64      -> R.Within { start, size = N.pow2 bits } (Address.confined start bits hash offset)
65    = \h start bits hash offset ->
66        let n = hash + offset
67        let below
68            : A.Lt (Natural/mod n (N.pow2 bits)) (N.pow2 bits)
69            = A.leElim
70                1
71                (N.pow2 bits)
72                (pow2Positive h bits)
73                (\(d : Natural) (size : 1 + d === N.pow2 bits) ->
74                   E.subst (\(m : Natural) -> A.Lt (Natural/mod n m) m) size (A.modLt h n d))
75        in  { lower = A.lePlusRight start (Natural/mod n (N.pow2 bits))
76            , upper =
77                A.lePlus
78                  start
79                  start
80                  (Natural/mod n (N.pow2 bits) + 1)
81                  (N.pow2 bits)
82                  (A.leRefl start)
83                  below
84            }
85
86-- L2: a block above the root object and inside the reservation is disjoint
87-- from the root object, and both lie in the reservation.
88let blockSeparate
89    : forall (rootSlots start bits size : Natural)
90      -> A.Le rootSlots start
91      -> A.Le (start + N.pow2 bits) size
92      -> { disjoint : R.Disjoint { start = 0, size = rootSlots } { start, size = N.pow2 bits }
93         , root : R.Inside { start = 0, size = rootSlots } { start = 0, size }
94         , block : R.Inside { start, size = N.pow2 bits } { start = 0, size }
95         }
96    = \rootSlots start bits size above inside ->
97        { disjoint = R.separate { start = 0, size = rootSlots } { start, size = N.pow2 bits } above
98        , root =
99            { lower = A.leRefl 0
100            , upper =
101                A.leTrans
102                  rootSlots
103                  start
104                  size
105                  above
106                  (A.leTrans
107                     start
108                     (start + N.pow2 bits)
109                     size
110                     (A.lePlusRight start (N.pow2 bits))
111                     inside)
112            }
113        , block = { lower = A.leZero start, upper = inside }
114        }
115
116-- The length of a concatenation.
117let lengthAppend
118    : forall {l : Level} {T : Type l} (xs ys : List T)
119      -> L.length (xs # ys) === L.length xs + L.length ys
120    = \{l} {T} xs ys ->
121        List/elim
122          (\(xs : List T) -> L.length (xs # ys) === L.length xs + L.length ys)
123          refl
124          (\(x : T)
125            (rest : List T)
126            (proof : L.length (rest # ys) === L.length rest + L.length ys) ->
127             E.cong (\(n : Natural) -> n + 1) proof)
128          xs
129
130-- No list is as long as a strictly longer list.
131let longer
132    : forall {l lr : Level} {T : Type l} {r : Type lr} (x : T) (rest s : List T)
133      -> L.length s === L.length ([ x ] # rest # s)
134      -> r
135    = \{l} {lr} {T} {r} x rest s same ->
136        let n = L.length s
137        let m = L.length rest
138        let sum
139            : n + 0 === n + (m + 1)
140            = E.trans
141                same
142                (E.cong (\(k : Natural) -> k + 1) (E.trans (lengthAppend rest s) (A.plusComm m n)))
143        in  A.succNotZero m (E.sym (A.plusCancelLeft 0 (m + 1) n sum))
144
145-- The first element and the rest of two equal non-empty lists are equal.
146let consInjective
147    : forall {l : Level} {T : Type l} (x y : T) (xs ys : List T)
148      -> [ x ] # xs === [ y ] # ys
149      -> (x === y) * (xs === ys)
150    = \{l} {T} x y xs ys same ->
151        (E.cong
152           (\(list : List T) ->
153              List/elim (\(_ : List T) -> T) x (\(z : T) (_ : List T) (_ : T) -> z) list)
154           same,
155        E.cong
156          (\(list : List T) ->
157             List/elim
158               (\(_ : List T) -> List T)
159               list
160               (\(_ : T) (rest : List T) (_ : List T) -> rest)
161               list)
162          same)
163
164-- L5: a concatenation of a prefix and a suffix of known length splits
165-- uniquely, so a preimage `keyBytes ‖ σ` determines its key bytes and σ.
166let appendCancel
167    : forall {l : Level} {T : Type l} (xs ys s t : List T)
168      -> L.length s === L.length t
169      -> xs # s === ys # t
170      -> (xs === ys) * (s === t)
171    = \{l} {T} xs ->
172        List/elim
173          (\(xs : List T) ->
174             forall (ys s t : List T)
175             -> L.length s === L.length t
176             -> xs # s === ys # t
177             -> (xs === ys) * (s === t))
178          (\(ys s t : List T) (lengths : L.length s === L.length t) (same : s === ys # t) ->
179             List/elim
180               (\(ys : List T) -> s === ys # t -> (([] : List T) === ys) * (s === t))
181               (\(same : s === t) -> (refl, same))
182               (\(y : T) (rest : List T) _ (same : s === [ y ] # rest # t) ->
183                  longer y rest t (E.trans (E.sym lengths) (E.cong L.length same)))
184               ys
185               same)
186          (\(x : T)
187            (rest : List T)
188            (recurse :
189              forall (ys s t : List T)
190              -> L.length s === L.length t
191              -> rest # s === ys # t
192              -> (rest === ys) * (s === t))
193            (ys s t : List T)
194            (lengths : L.length s === L.length t)
195            (same : [ x ] # rest # s === ys # t) ->
196             List/elim
197               (\(ys : List T) -> [ x ] # rest # s === ys # t -> ([ x ] # rest === ys) * (s === t))
198               (\(same : [ x ] # rest # s === t) ->
199                  longer x rest s (E.trans lengths (E.cong L.length (E.sym same))))
200               (\(y : T) (others : List T) _ (same : [ x ] # rest # s === [ y ] # others # t) ->
201                  let parts = consInjective x y (rest # s) (others # t) same
202                  let tails = recurse others s t lengths parts.2
203                  in  (E.trans
204                         (E.cong (\(z : T) -> [ z ] # rest) parts.1)
205                         (E.cong (\(zs : List T) -> [ y ] # zs) tails.1),
206                      tails.2))
207               ys
208               same)
209          xs
210
211-- L6: a checked addition succeeds exactly when the sum stays below the
212-- limit, and then returns the sum.
213let checkedAddSound
214    : A.NatFacts
215      -> forall (limitBits count added result : Natural)
216      -> Address.checkedAdd limitBits count added === Some result
217      -> (result === count + added) * A.Lt result (N.pow2 limitBits)
218    = \h limitBits count added result ->
219        let sum = count + added
220        let limit = N.pow2 limitBits
221        in  Bool/elim
222              (\(fits : Bool) ->
223                 N.lessThan sum limit === fits
224                 -> (if fits then Some sum else None Natural) === Some result
225                 -> (result === sum) * A.Lt result limit)
226              (\(fits : N.lessThan sum limit === True) (same : Some sum === Some result) ->
227                 let equal : sum === result = E.cong (O.default sum) same
228                 in  (E.sym equal,
229                     E.subst
230                       (\(n : Natural) -> A.Lt n limit)
231                       equal
232                       (A.decideLtSound h sum limit fits)))
233              (\_ (same : None Natural === Some result) ->
234                 A.exFalso
235                   (E.subst
236                      (\(o : Optional Natural) ->
237                         Optional/elim
238                           (\(_ : Optional Natural) -> Type)
239                           {}
240                           (\(_ : Natural) -> <>)
241                           o)
242                      same
243                      {=}))
244              (N.lessThan sum limit)
245              refl
246
247-- A divisor at most a number leaves a positive quotient.
248let quotientPositive
249    : A.NatFacts -> forall (n d : Natural) -> A.Le (d + 1) n -> A.Lt 0 (Natural/div n (d + 1))
250    = \h n d le ->
251        let q = Natural/div n (d + 1)
252        let r = Natural/mod n (d + 1)
253        in  merge
254              { Lt = \(p : A.Lt q 0) -> A.leLtAbsurd 0 q (A.leZero q) p
255              , Eq =
256                  \(p : q === 0) ->
257                    let same
258                        : r === n
259                        = E.trans
260                            (E.cong (\(x : Natural) -> x * (d + 1) + r) (E.sym p))
261                            (h.divMod n d)
262                    in  A.leLtAbsurd
263                          (d + 1)
264                          n
265                          le
266                          (E.subst (\(x : Natural) -> A.Lt x (d + 1)) same (A.modLt h n d))
267              , Gt = \(p : A.Lt 0 q) -> p
268              }
269              (A.compare q 0)
270
271-- A quotient grows with the number.
272let divMonotone
273    : A.NatFacts
274      -> forall (a b e : Natural)
275      -> A.Le a b
276      -> A.Le (Natural/div a (e + 1)) (Natural/div b (e + 1))
277    = \h a b e le ->
278        let qa = Natural/div a (e + 1)
279        let qb = Natural/div b (e + 1)
280        let ra = Natural/mod a (e + 1)
281        let rb = Natural/mod b (e + 1)
282        in  merge
283              { Le = \(p : A.Le qa qb) -> p
284              , Gt =
285                  \(p : A.Lt qb qa) ->
286                    A.leLtAbsurd
287                      a
288                      b
289                      le
290                      (E.subst
291                         (\(x : Natural) -> A.Lt x a)
292                         (h.divMod b e)
293                         (E.subst
294                            (\(y : Natural) -> A.Lt (qb * (e + 1) + rb) y)
295                            (h.divMod a e)
296                            (A.euclidLt h e qb rb qa ra (A.modLt h b e) p)))
297              }
298              (A.leTotal qa qb)
299
300-- Bit `b` of entry `r` of a slot of `e + 1` entries of `d + 1` bits lies in
301-- the slot.
302let entryBelow
303    : A.NatFacts
304      -> forall (e d r b : Natural)
305      -> A.Le ((e + 1) * (d + 1)) 256
306      -> A.Lt r (e + 1)
307      -> A.Lt b (d + 1)
308      -> A.Lt (r * (d + 1) + b) 256
309    = \h e d r b fits small bit ->
310        let base = r * (d + 1)
311        in  A.leTrans
312              (base + b + 1)
313              ((r + 1) * (d + 1))
314              256
315              (A.leTransEq
316                 (base + b + 1)
317                 (base + (d + 1))
318                 ((r + 1) * (d + 1))
319                 (A.lePlus base base (b + 1) (d + 1) (A.leRefl base) bit)
320                 (E.sym (h.timesSucc r (d + 1))))
321              (A.leTrans
322                 ((r + 1) * (d + 1))
323                 ((e + 1) * (d + 1))
324                 256
325                 (A.leTimesRight h (r + 1) (e + 1) (d + 1) small)
326                 fits)
327
328let regroup
329    : A.NatFacts -> forall (q r b : Natural) -> 256 * q + r + b === q * 256 + (r + b)
330    = \h q r b ->
331        E.trans
332          (A.plusAssoc (256 * q) r b)
333          (E.cong (\(x : Natural) -> x + (r + b)) (A.timesComm h 256 q))
334
335-- Packed entries of distinct indices or bits never meet.
336let packedInjective
337    : A.NatFacts
338      -> forall (e d i j b c : Natural)
339      -> A.Le ((e + 1) * (d + 1)) 256
340      -> A.Lt b (d + 1)
341      -> A.Lt c (d + 1)
342      -> 256 * Natural/div i (e + 1) + Natural/mod i (e + 1) * (d + 1) + b
343         === 256 * Natural/div j (e + 1) + Natural/mod j (e + 1) * (d + 1) + c
344      -> (i === j) * (b === c)
345    = \h e d i j b c fits bs cs same ->
346        let qi = Natural/div i (e + 1)
347        let ri = Natural/mod i (e + 1)
348        let qj = Natural/div j (e + 1)
349        let rj = Natural/mod j (e + 1)
350        let outer =
351              A.euclidUnique
352                h
353                255
354                qi
355                (ri * (d + 1) + b)
356                qj
357                (rj * (d + 1) + c)
358                (entryBelow h e d ri b fits (A.modLt h i e) bs)
359                (entryBelow h e d rj c fits (A.modLt h j e) cs)
360                (E.trans
361                   (E.sym (regroup h qi (ri * (d + 1)) b))
362                   (E.trans same (regroup h qj (rj * (d + 1)) c)))
363        let inner = A.euclidUnique h d ri b rj c bs cs outer.2
364        in  (E.trans
365               (E.sym (h.divMod i e))
366               (E.trans
367                  (E.trans
368                     (E.cong (\(x : Natural) -> x * (e + 1) + ri) outer.1)
369                     (E.cong (\(x : Natural) -> qj * (e + 1) + x) inner.1))
370                  (h.divMod j e)),
371            inner.2)
372
373-- L3, first part: bit `b` of entry `i` and bit `c` of entry `j` at a
374-- positive stride coincide only when `i = j` and `b = c`. A list's
375-- elements and a direct mapping's entries therefore never overlap.
376let placeInjective
377    : A.NatFacts
378      -> forall (d i j b c : Natural)
379      -> A.Lt b (d + 1)
380      -> A.Lt c (d + 1)
381      -> Address.place (d + 1) i + b === Address.place (d + 1) j + c
382      -> (i === j) * (b === c)
383    = \h d i j b c bs cs ->
384        let s = d + 1
385        let slots = Natural/div 256 s
386        let packed = \(k : Natural) -> 256 * Natural/div k slots + Natural/mod k slots * s
387        in  Bool/elim
388              (\(fits : Bool) ->
389                 N.lessThanEqual s 256 === fits
390                 -> (if fits then packed i else i * s) + b
391                    === (if fits then packed j else j * s) + c
392                 -> (i === j) * (b === c))
393              (\(fits : N.lessThanEqual s 256 === True) (same : packed i + b === packed j + c) ->
394                 A.leElim
395                   1
396                   slots
397                   (quotientPositive h 256 d (A.decideLeSound h s 256 fits))
398                   (\(e : Natural) (count : 1 + e === slots) ->
399                      E.subst
400                        (\(x : Natural) ->
401                           A.Le (x * s) 256
402                           -> 256 * Natural/div i x + Natural/mod i x * s + b
403                              === 256 * Natural/div j x + Natural/mod j x * s + c
404                           -> (i === j) * (b === c))
405                        count
406                        (\(within : A.Le ((e + 1) * s) 256) ->
407                           packedInjective h e d i j b c within bs cs)
408                        (A.divTimesLe h 256 s)
409                        same))
410              (\_ (same : i * s + b === j * s + c) -> A.euclidUnique h d i b j c bs cs same)
411              (N.lessThanEqual s 256)
412              refl
413
414-- Packed entries of indices below `n` lie in `slotsFor n` slots.
415let packedBelow
416    : A.NatFacts
417      -> forall (e d n i b : Natural)
418      -> A.Le ((e + 1) * (d + 1)) 256
419      -> A.Lt i n
420      -> A.Lt b (d + 1)
421      -> A.Lt
422           (256 * Natural/div i (e + 1) + Natural/mod i (e + 1) * (d + 1) + b)
423           (256 * Natural/div (n + e) (e + 1))
424    = \h e d n i b fits below bit ->
425        let qi = Natural/div i (e + 1)
426        let entry = Natural/mod i (e + 1) * (d + 1) + b
427        let start = 256 * qi + Natural/mod i (e + 1) * (d + 1) + b
428        let next = A.divModPlusTimes h i e 1
429        in  A.leTrans
430              (start + 1)
431              (256 * (qi + 1))
432              (256 * Natural/div (n + e) (e + 1))
433              (A.eqTransLe
434                 (start + 1)
435                 (256 * qi + (entry + 1))
436                 (256 * (qi + 1))
437                 (E.cong
438                    (\(x : Natural) -> x + 1)
439                    (A.plusAssoc (256 * qi) (Natural/mod i (e + 1) * (d + 1)) b))
440                 (A.leTransEq
441                    (256 * qi + (entry + 1))
442                    (256 * qi + 256)
443                    (256 * (qi + 1))
444                    (A.lePlus
445                       (256 * qi)
446                       (256 * qi)
447                       (entry + 1)
448                       256
449                       (A.leRefl (256 * qi))
450                       (entryBelow h e d (Natural/mod i (e + 1)) b fits (A.modLt h i e) bit))
451                    (E.sym (A.timesSuccRight h 256 qi))))
452              (A.leTimesLeft
453                 h
454                 (qi + 1)
455                 (Natural/div (n + e) (e + 1))
456                 256
457                 (A.eqTransLe
458                    (qi + 1)
459                    (Natural/div (i + 1 * (e + 1)) (e + 1))
460                    (Natural/div (n + e) (e + 1))
461                    (E.sym next.1)
462                    (divMonotone
463                       h
464                       (i + 1 * (e + 1))
465                       (n + e)
466                       e
467                       (A.lePlus (i + 1) n e e below (A.leRefl e)))))
468
469-- Whole-slot entries of indices below `n` lie in `slotsFor n` slots.
470let wholeBelow
471    : A.NatFacts
472      -> forall (d n i b : Natural)
473      -> Natural/mod (d + 1) 256 === 0
474      -> A.Lt i n
475      -> A.Lt b (d + 1)
476      -> A.Lt (i * (d + 1) + b) (256 * Natural/div (n * (d + 1)) 256)
477    = \h d n i b zero below bit ->
478        let s = d + 1
479        let t = Natural/div s 256
480        let slots
481            : t * 256 === s
482            = E.trans (E.cong (\(x : Natural) -> t * 256 + x) (E.sym zero)) (h.divMod s 255)
483        let regular
484            : n * s === n * t * 256
485            = E.trans
486                (E.cong (\(x : Natural) -> n * x) (E.sym slots))
487                (E.sym (A.timesAssoc h n t 256))
488        let total
489            : 256 * Natural/div (n * s) 256 === n * s
490            = E.trans
491                (E.cong (\(x : Natural) -> 256 * Natural/div x 256) regular)
492                (E.trans
493                   (E.cong (\(x : Natural) -> 256 * x) (A.divTimes h (n * t) 255))
494                   (E.trans (A.timesComm h 256 (n * t)) (E.sym regular)))
495        in  A.leTransEq
496              (i * s + b + 1)
497              (n * s)
498              (256 * Natural/div (n * s) 256)
499              (A.leTrans
500                 (i * s + b + 1)
501                 ((i + 1) * s)
502                 (n * s)
503                 (A.leTransEq
504                    (i * s + b + 1)
505                    (i * s + s)
506                    ((i + 1) * s)
507                    (A.lePlus (i * s) (i * s) (b + 1) s (A.leRefl (i * s)) bit)
508                    (E.sym (h.timesSucc i s)))
509                 (A.leTimesRight h (i + 1) n s below))
510              (E.sym total)
511
512-- L3, second part: at a stride that validity admits (at most a slot, or
513-- whole slots), the bits of the entries of indices below `n` lie in the
514-- `slotsFor n` slots of the list's data or of the direct mapping's array,
515-- whose extent validity checks.
516let placeBelow
517    : A.NatFacts
518      -> forall (d n i b : Natural)
519      -> N.lessThanEqual (d + 1) 256 || N.isZero (Natural/mod (d + 1) 256) === True
520      -> A.Lt i n
521      -> A.Lt b (d + 1)
522      -> A.Lt (Address.place (d + 1) i + b) (256 * Address.slotsFor n (d + 1))
523    = \h d n i b admitted below bit ->
524        let s = d + 1
525        let slots = Natural/div 256 s
526        in  Bool/elim
527              (\(fits : Bool) ->
528                 N.lessThanEqual s 256 === fits
529                 -> fits || N.isZero (Natural/mod s 256) === True
530                 -> A.Lt
531                      ((if fits
532                        then 256 * Natural/div i slots + Natural/mod i slots * s
533                        else i * s)
534                       + b)
535                      (256
536                       * (if fits
537                          then Natural/div (n + N.minus slots 1) slots
538                          else Natural/div (n * s) 256)))
539              (\(fits : N.lessThanEqual s 256 === True) _ ->
540                 A.leElim
541                   1
542                   slots
543                   (quotientPositive h 256 d (A.decideLeSound h s 256 fits))
544                   (\(e : Natural) (count : 1 + e === slots) ->
545                      E.subst
546                        (\(x : Natural) ->
547                           A.Le (x * s) 256
548                           -> A.Lt
549                                (256 * Natural/div i x + Natural/mod i x * s + b)
550                                (256 * Natural/div (n + N.minus x 1) x))
551                        count
552                        (\(within : A.Le ((e + 1) * s) 256) ->
553                           E.subst
554                             (\(x : Natural) ->
555                                A.Lt
556                                  (256 * Natural/div i (e + 1) + Natural/mod i (e + 1) * s + b)
557                                  (256 * Natural/div (n + x) (e + 1)))
558                             (E.sym (h.subtractSucc 0 e))
559                             (packedBelow h e d n i b within below bit))
560                        (A.divTimesLe h 256 s)))
561              (\_ (whole : N.isZero (Natural/mod s 256) === True) ->
562                 wholeBelow h d n i b (A.isZeroSound (Natural/mod s 256) whole) below bit)
563              (N.lessThanEqual s 256)
564              refl
565              admitted
566
567-- L4, for address keys: an address key's encoding, the index of its entry
568-- in a direct mapping, determines the key, so distinct keys select
569-- distinct entries (L3). `std:Arith.word256Ext` is the same for 256-bit
570-- keys.
571let addressInjective
572    : forall (a b : Word 160) -> Word/toNatural a === Word/toNatural b -> a === b
573    = \a b same ->
574        let back =
575              Word/elim
576                (\(w : Word 160) -> Word/fromNatural 160 (Word/toNatural w) === w)
577                (\(n : Natural) -> refl)
578        in  E.trans (E.sym (back a)) (E.trans (E.cong (Word/fromNatural 160) same) (back b))
579
580let checkedAddComplete
581    : A.NatFacts
582      -> forall (limitBits count added result : Natural)
583      -> result === count + added
584      -> A.Lt result (N.pow2 limitBits)
585      -> Address.checkedAdd limitBits count added === Some result
586    = \h limitBits count added result equal below ->
587        let sum = count + added
588        let limit = N.pow2 limitBits
589        let fits
590            : N.lessThan sum limit === True
591            = A.decideLtComplete h sum limit (E.subst (\(n : Natural) -> A.Lt n limit) equal below)
592        in  E.trans
593              (E.cong (\(b : Bool) -> if b then Some sum else None Natural) fits)
594              (E.cong (\(n : Natural) -> Some n) (E.sym equal))
595
596in  { pow2Positive
597    , confinedWithin
598    , blockSeparate
599    , lengthAppend
600    , appendCancel
601    , checkedAddSound
602    , checkedAddComplete
603    , placeInjective
604    , placeBelow
605    , addressInjective
606    }
Your result
Complete file: lib/EVM/State/Layout/Laws.omg · with imports