lawspec 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/CHANGELOG.md +109 -1
  2. package/README.md +34 -26
  3. package/UNICODE-LICENSE.txt +39 -0
  4. package/api.mjs +6 -23
  5. package/bin/lawspec.mjs +148 -65
  6. package/build.json +245 -177
  7. package/builtin-data-names.mjs +73 -0
  8. package/core.wasm +2 -2
  9. package/core_jsffi.js +5 -0
  10. package/examples/native-payments/clojure/lawspec.json +13 -2
  11. package/examples/native-payments/csharp/lawspec.json +13 -2
  12. package/examples/native-payments/elixir/lawspec.json +14 -3
  13. package/examples/native-payments/erlang/lawspec.json +14 -3
  14. package/examples/native-payments/fsharp/lawspec.json +14 -3
  15. package/examples/native-payments/gleam/lawspec.json +14 -3
  16. package/examples/native-payments/go/lawspec.json +14 -3
  17. package/examples/native-payments/groovy/lawspec.json +14 -3
  18. package/examples/native-payments/haskell/lawspec.json +14 -3
  19. package/examples/native-payments/java/lawspec.json +14 -3
  20. package/examples/native-payments/javascript/lawspec.json +14 -3
  21. package/examples/native-payments/kotlin/lawspec.json +14 -3
  22. package/examples/native-payments/python/lawspec.json +14 -3
  23. package/examples/native-payments/rust/lawspec.json +14 -3
  24. package/examples/native-payments/scala/lawspec.json +14 -3
  25. package/examples/native-payments/swift/lawspec.json +14 -3
  26. package/examples/native-payments/typescript/lawspec.json +14 -3
  27. package/examples/packages/orders/lawspec.json +25 -5
  28. package/examples/packages/orders/orders.lawspec +57 -53
  29. package/examples/packages/shop-domain/src/domain.lawspec +36 -33
  30. package/examples/packages/shop-tax-1/src/api.lawspec +1 -0
  31. package/examples/packages/shop-tax-1/src/rates.lawspec +5 -4
  32. package/examples/packages/shop-tax-2/src/api.lawspec +1 -0
  33. package/examples/packages/shop-tax-2/src/rates.lawspec +6 -4
  34. package/examples/rc1/authorization-snapshots.lawspec +113 -0
  35. package/examples/rc1/banner-filenames.lawspec +64 -0
  36. package/examples/rc1/bit-codec.lawspec +57 -0
  37. package/examples/rc1/bounded-witness-search.lawspec +151 -0
  38. package/examples/rc1/conflicting-requirements.lawspec +31 -0
  39. package/examples/rc1/constructive-witnesses.lawspec +120 -0
  40. package/examples/rc1/documentary-review.lawspec +43 -0
  41. package/examples/rc1/empty-domains.lawspec +47 -0
  42. package/examples/rc1/finite-integer-domains.lawspec +76 -0
  43. package/examples/rc1/law-metadata.lawspec +30 -0
  44. package/examples/rc1/native-payments.lawspec +108 -0
  45. package/examples/rc1/nesting/rrr.lawspec +34 -0
  46. package/examples/rc1/nesting/rru.lawspec +57 -0
  47. package/examples/rc1/nesting/rur.lawspec +58 -0
  48. package/examples/rc1/nesting/ruu.lawspec +78 -0
  49. package/examples/rc1/nesting/urr.lawspec +53 -0
  50. package/examples/rc1/nesting/uru.lawspec +73 -0
  51. package/examples/rc1/nesting/uur.lawspec +74 -0
  52. package/examples/rc1/nesting/uuu.lawspec +96 -0
  53. package/examples/rc1/order-workflow.lawspec +127 -0
  54. package/examples/rc1/parcel-measurements.lawspec +93 -0
  55. package/examples/rc1/picture-records.lawspec +52 -0
  56. package/examples/rc1/picture-tuples.lawspec +48 -0
  57. package/examples/rc1/record-payloads.lawspec +57 -0
  58. package/examples/rc1/recursive-records.lawspec +65 -0
  59. package/examples/rc1/refund-conformance.lawspec +45 -0
  60. package/examples/rc1/refund-policy.lawspec +89 -0
  61. package/examples/rc1/requirement-composition.lawspec +90 -0
  62. package/examples/rc1/structural-records.lawspec +54 -0
  63. package/examples/rc1-authoring.lawspec +57 -0
  64. package/examples/specs/abilities.lawspec +67 -65
  65. package/examples/specs/ability_imports.lawspec +58 -57
  66. package/examples/specs/actors.lawspec +23 -22
  67. package/examples/specs/algebra.lawspec +142 -141
  68. package/examples/specs/approvals.lawspec +16 -15
  69. package/examples/specs/async_bindings.lawspec +10 -9
  70. package/examples/specs/async_fetch.lawspec +12 -11
  71. package/examples/specs/atoi_codec.lawspec +16 -15
  72. package/examples/specs/boolean_flags.lawspec +10 -9
  73. package/examples/specs/builtins.lawspec +73 -72
  74. package/examples/specs/canonical_url.lawspec +14 -13
  75. package/examples/specs/collections.lawspec +153 -154
  76. package/examples/specs/composition.lawspec +70 -66
  77. package/examples/specs/concurrent_collections.lawspec +8 -7
  78. package/examples/specs/consistency.lawspec +4 -3
  79. package/examples/specs/contracts.lawspec +80 -79
  80. package/examples/specs/crypto.lawspec +26 -25
  81. package/examples/specs/ctc.lawspec +148 -0
  82. package/examples/specs/currying.lawspec +32 -31
  83. package/examples/specs/data_types.lawspec +50 -49
  84. package/examples/specs/distribution.lawspec +57 -56
  85. package/examples/specs/domain_modeling.lawspec +48 -47
  86. package/examples/specs/durations.lawspec +39 -38
  87. package/examples/specs/equivalent.lawspec +25 -24
  88. package/examples/specs/failures.lawspec +64 -63
  89. package/examples/specs/finite_data.lawspec +32 -31
  90. package/examples/specs/flow_stack.lawspec +64 -63
  91. package/examples/specs/gadt_expressions.lawspec +50 -49
  92. package/examples/specs/generation.lawspec +115 -114
  93. package/examples/specs/handler_bindings.lawspec +42 -40
  94. package/examples/specs/handles.lawspec +2 -1
  95. package/examples/specs/harness.lawspec +45 -43
  96. package/examples/specs/harness_testing.lawspec +18 -13
  97. package/examples/specs/indexed_arithmetic.lawspec +401 -126
  98. package/examples/specs/indexed_families.lawspec +182 -66
  99. package/examples/specs/keywords.lawspec +22 -21
  100. package/examples/specs/limits.lawspec +6 -5
  101. package/examples/specs/list_contracts.lawspec +121 -120
  102. package/examples/specs/list_refinements.lawspec +43 -42
  103. package/examples/specs/lists.lawspec +45 -44
  104. package/examples/specs/matchers.lawspec +79 -78
  105. package/examples/specs/matching.lawspec +43 -42
  106. package/examples/specs/mixed_inputs.lawspec +25 -24
  107. package/examples/specs/models.lawspec +44 -43
  108. package/examples/specs/parse_port.lawspec +28 -27
  109. package/examples/specs/payments.lawspec +55 -54
  110. package/examples/specs/railway.lawspec +59 -58
  111. package/examples/specs/records.lawspec +149 -148
  112. package/examples/specs/records_inner.lawspec +5 -4
  113. package/examples/specs/recursive_refinements.lawspec +30 -29
  114. package/examples/specs/refined_definitions.lawspec +24 -23
  115. package/examples/specs/refinements.lawspec +58 -57
  116. package/examples/specs/resilience.lawspec +159 -158
  117. package/examples/specs/resources.lawspec +61 -60
  118. package/examples/specs/scalar_adapters.lawspec +60 -59
  119. package/examples/specs/scalar_catalog.lawspec +165 -164
  120. package/examples/specs/scalars.lawspec +78 -77
  121. package/examples/specs/scheduling_order.lawspec +8 -7
  122. package/examples/specs/scheduling_overlap.lawspec +5 -4
  123. package/examples/specs/sequences.lawspec +66 -65
  124. package/examples/specs/sessions.lawspec +13 -12
  125. package/examples/specs/slug.lawspec +16 -15
  126. package/examples/specs/sum_refinements.lawspec +42 -41
  127. package/examples/specs/tables.lawspec +29 -28
  128. package/examples/specs/total_functions.lawspec +71 -70
  129. package/examples/specs/workflows.lawspec +101 -100
  130. package/examples-command.mjs +8 -4
  131. package/explain.mjs +114 -0
  132. package/expression-presentation.mjs +333 -0
  133. package/files.mjs +16 -0
  134. package/index.d.ts +406 -11
  135. package/launcher.mjs +9 -2
  136. package/lsp.mjs +235 -0
  137. package/native-evidence.mjs +187 -0
  138. package/native-examples.mjs +8 -1
  139. package/node-events-reporter.mjs +23 -0
  140. package/package.json +8 -1
  141. package/positional-fields.mjs +13 -0
  142. package/proof.d.ts +35 -0
  143. package/proof.mjs +174 -0
  144. package/starter-rc1.lawspec +26 -0
  145. package/starter.lawspec +16 -15
  146. package/templates.mjs +6 -4
  147. package/test-command.mjs +107 -35
  148. package/typed-presentation.mjs +165 -0
@@ -3,38 +3,38 @@ unit example.arithmetic
3
3
  -- Index equations may use natural arithmetic: + - * div mod ^. Subtraction
4
4
  -- never truncates, so `m - 1` requires m >= 1 of every value. A variable bound
5
5
  -- by several fields makes those fields' indices equal.
6
- type Row (n :: Natural) is
6
+ type Row (n :: Whole) is one of
7
7
  | End where n = 0
8
- | Cell head :: Int8 tail :: Row m where n = m + 1
9
- end
8
+ | Cell of type record{ head :: Int8 tail :: Row m} where n = m + 1
9
+ end type
10
10
 
11
11
  -- A perfect tree: both subtrees share one height.
12
- type Perfect (n :: Natural) is
13
- | Leaf value :: Int8 where n = 0
14
- | Node left :: Perfect m right :: Perfect m where n = m + 1
15
- end
12
+ type Perfect (n :: Whole) is one of
13
+ | Leaf of type Int8 where n = 0
14
+ | Node of type record{ left :: Perfect m right :: Perfect m} where n = m + 1
15
+ end type
16
16
 
17
17
  -- A grid's index is its number of cells.
18
- type Grid (n :: Natural) is
19
- | Grid rows :: Row r columns :: Row c where n = r * c
20
- end
18
+ type Grid (n :: Whole) is one of
19
+ | Grid of type record{ rows :: Row r columns :: Row c} where n = r * c
20
+ end type
21
21
 
22
22
  -- Two halves of one length.
23
- type Halves (n :: Natural) is
24
- | Halves front :: Row m back :: Row m where n = m + m
25
- end
23
+ type Halves (n :: Whole) is one of
24
+ | Halves of type record{ front :: Row m back :: Row m} where n = m + m
25
+ end type
26
26
 
27
27
  -- The number of whole pairs, and the length after the first element.
28
- type Pairs (n :: Natural) is
29
- | Pairs items :: Row m where n = m div 2
30
- end
28
+ type Pairs (n :: Whole) is one of
29
+ | Pairs of type Row m where n = m div 2
30
+ end type
31
31
 
32
- type Rest (n :: Natural) is
33
- | Rest items :: Row m where n = m - 1
34
- end
32
+ type Rest (n :: Whole) is one of
33
+ | Rest of type Row m where n = m - 1
34
+ end type
35
35
 
36
36
  mirror :: (tree :: Perfect n) -> (r :: Perfect n)
37
- area :: (grid :: Grid n) -> BigInt
37
+ area :: (grid :: Grid n) -> Integer
38
38
  duplicate :: (xs :: Row m) -> (r :: Halves (m + m))
39
39
  countPairs :: (xs :: Row m) -> (r :: Pairs (m div 2))
40
40
  -- `k + 1` binds k to one less than the argument's length.
@@ -44,111 +44,386 @@ dropFirst :: (xs :: Row (k + 1)) -> (r :: Rest k)
44
44
  -- height, so mirrorP's result height is proved; so is transposeG's, as r * c
45
45
  -- and c * r are the same product. stackRows' claim, (r + r) * c = 2 * (r * c),
46
46
  -- is beyond linear arithmetic: it is checked on each result instead.
47
- definition mirrorP (tree :: Perfect n) :: Perfect n is
48
- match tree with
49
- | Leaf v -> Leaf v
50
- | Node l r -> Node (mirrorP r) (mirrorP l)
51
- end
52
- end
53
-
54
- definition transposeG (grid :: Grid n) :: Grid n is
55
- match grid with
56
- | Grid rows columns -> Grid columns rows
57
- end
58
- end
59
-
60
- definition appendRow (xs :: Row n) (ys :: Row m) :: Row (n + m) is
61
- match xs with
62
- | End -> ys
63
- | Cell h t -> Cell h (appendRow t ys)
64
- end
65
- end
66
-
67
- definition stackRows (grid :: Grid n) :: Grid (2 * n) is
68
- match grid with
69
- | Grid rows columns -> Grid (appendRow rows rows) columns
70
- end
71
- end
72
-
73
- law `mirror agrees with the proved definition` is
74
- definition is
75
- `for all` (tree :: Perfect 3) . mirror tree = mirrorP tree
76
- end
77
- end
78
-
79
- law `transposing keeps the area` is
80
- definition is
81
- `for all` (grid :: Grid 12) . area (transposeG grid) = 12
82
- end
83
- end
84
-
85
- law `stacking doubles the area` is
86
- definition is
87
- `for all` (grid :: Grid 6) . area (stackRows grid) = 12
88
- end
89
- end
90
-
91
- -- Without an index claim, balanced trees are still generated directly, from a
92
- -- few small heights; random trees would almost never be balanced.
93
- law `mirroring twice restores a tree` is
94
- definition is
95
- `for all` (tree :: Perfect n) . mirror (mirror tree) = tree
96
- end
97
- end
98
-
99
- law `mirroring keeps the height` is
100
- definition is
101
- `for all` (tree :: Perfect 3) . nOfPerfect (mirror tree) = 3
102
- end
103
- end
104
-
105
- law `a grid of six cells` is
106
- definition is
107
- `for all` (grid :: Grid 6) . area grid = 6
108
- end
109
- end
110
-
111
- -- Generation chooses rows and columns among the divisors of twelve.
112
- law `the area is the index` is
113
- definition is
114
- `for all` (grid :: Grid 12) . area grid = nOfGrid grid
115
- end
116
- end
117
-
118
- law `duplicating makes equal halves` is
119
- definition is
120
- `for all` (xs :: Row m) . nOfHalves (duplicate xs) = m + m
121
- end
122
- end
123
-
124
- -- Generation gives both halves the same length.
125
- law `halves of six` is
126
- definition is
127
- `for all` (halves :: Halves 6) . nOfHalves halves = 6
128
- end
129
- end
130
-
131
- law `seven elements make three pairs` is
132
- definition is
133
- `for all` (xs :: Row 7) . nOfPairs (countPairs xs) = 3
134
- end
135
- end
47
+ function mirrorP (tree :: Perfect n) -> Perfect n is
48
+ first matching case of tree :
49
+ when Leaf v then Leaf v
50
+ when Node record{ left = l , right = r} then Node record{ left = (mirrorP r)
51
+ , right = (mirrorP l)}
52
+ end case
53
+ end function
54
+
55
+ function transposeG (grid :: Grid n) -> Grid n is
56
+ first matching case of grid :
57
+ when Grid record{ rows = rows , columns = columns} then Grid record{ rows =
58
+ columns , columns = rows}
59
+ end case
60
+ end function
61
+
62
+ function appendRow (xs :: Row n) (ys :: Row m) -> Row (n + m) is
63
+ first matching case of xs :
64
+ when End then ys
65
+ when Cell record{ head = h , tail = t} then Cell record{ head = h , tail =
66
+ (appendRow t ys)}
67
+ end case
68
+ end function
69
+
70
+ function stackRows (grid :: Grid n) -> Grid (2 * n) is
71
+ first matching case of grid :
72
+ when Grid record{ rows = rows , columns = columns} then Grid record{ rows =
73
+ (appendRow rows rows) , columns = columns}
74
+ end case
75
+ end function
76
+
77
+ law "|mirror agrees with the proved definition| is
78
+ definition :
79
+ for all (tree :: Perfect 3) => mirror tree = mirrorP tree end for all
80
+ end definition
81
+ end law
82
+
83
+ law "|transposing keeps the area| is
84
+ definition :
85
+ for all (grid :: Grid 12) => area (transposeG grid) = 12 end for all
86
+ end definition
87
+ end law
88
+
89
+ law "|stacking doubles the area| is
90
+ definition :
91
+ for all (grid :: Grid 6) => area (stackRows grid) = 12 end for all
92
+ end definition
93
+ end law
94
+
95
+ -- Without a fixed height, ordinary checked generation retains the balance
96
+ -- guards. The harness constructs the fixed-height cases below.
97
+ law "|mirroring twice restores a tree| is
98
+ definition :
99
+ for all (tree :: Perfect n) => mirror (mirror tree) = tree end for all
100
+ end definition
101
+ end law
102
+
103
+ law "|mirroring keeps the height| is
104
+ definition :
105
+ for all (tree :: Perfect 3) => nOfPerfect (mirror tree) = 3 end for all
106
+ end definition
107
+ end law
108
+
109
+ law "|a grid of six cells| is
110
+ definition :
111
+ for all (grid :: Grid 6) => area grid = 6 end for all
112
+ end definition
113
+ end law
114
+
115
+ -- The harness chooses every factorization of twelve.
116
+ law "|the area is the index| is
117
+ definition :
118
+ for all (grid :: Grid 12) => area grid = nOfGrid grid end for all
119
+ end definition
120
+ end law
121
+
122
+ law "|duplicating makes equal halves| is
123
+ definition :
124
+ for all (xs :: Row m) => nOfHalves (duplicate xs) = m + m end for all
125
+ end definition
126
+ end law
127
+
128
+ -- The harness constructs equal-length halves with independent cell values.
129
+ law "|halves of six| is
130
+ definition :
131
+ for all (halves :: Halves 6) => nOfHalves halves = 6 end for all
132
+ end definition
133
+ end law
134
+
135
+ law "|seven elements make three pairs| is
136
+ definition :
137
+ for all (xs :: Row 7) => nOfPairs (countPairs xs) = 3 end for all
138
+ end definition
139
+ end law
136
140
 
137
141
  -- A child may have a larger index than its parent: Pairs 2 holds four or five.
138
- law `two pairs` is
139
- definition is
140
- `for all` (p :: Pairs 2) . nOfPairs p = 2
141
- end
142
- end
143
-
144
- law `the rest is one shorter` is
145
- definition is
146
- `for all` (xs :: Row (k + 1)) . nOfRest (dropFirst xs) = k
147
- end
148
- end
149
-
150
- law `the rest of three` is
151
- definition is
152
- `for all` (r :: Rest 3) . nOfRest r = 3
153
- end
154
- end
142
+ law "|two pairs| is
143
+ definition :
144
+ for all (p :: Pairs 2) => nOfPairs p = 2 end for all
145
+ end definition
146
+ end law
147
+
148
+ law "|the rest is one shorter| is
149
+ definition :
150
+ for all (xs :: Row (k + 1)) => nOfRest (dropFirst xs) = k end for all
151
+ end definition
152
+ end law
153
+
154
+ law "|the rest of three| is
155
+ definition :
156
+ for all (r :: Rest 3) => nOfRest r = 3 end for all
157
+ end definition
158
+ end law
159
+
160
+ harness example.arithmetic.shapes for example.arithmetic is
161
+
162
+ strategy row0 of type Row 0 is
163
+ one of End
164
+ end strategy
165
+
166
+ strategy row1 of type Row 1 is
167
+ bind tail of type Row 0 from row0 in
168
+ bind head of type Int8 from any in
169
+ one of Cell record{head = head, tail = tail}
170
+ end bind
171
+ end bind
172
+ end strategy
173
+
174
+ strategy row2 of type Row 2 is
175
+ bind tail of type Row 1 from row1 in
176
+ bind head of type Int8 from any in
177
+ one of Cell record{head = head, tail = tail}
178
+ end bind
179
+ end bind
180
+ end strategy
181
+
182
+ strategy row3 of type Row 3 is
183
+ bind tail of type Row 2 from row2 in
184
+ bind head of type Int8 from any in
185
+ one of Cell record{head = head, tail = tail}
186
+ end bind
187
+ end bind
188
+ end strategy
189
+
190
+ strategy row4 of type Row 4 is
191
+ bind tail of type Row 3 from row3 in
192
+ bind head of type Int8 from any in
193
+ one of Cell record{head = head, tail = tail}
194
+ end bind
195
+ end bind
196
+ end strategy
197
+
198
+ strategy row5 of type Row 5 is
199
+ bind tail of type Row 4 from row4 in
200
+ bind head of type Int8 from any in
201
+ one of Cell record{head = head, tail = tail}
202
+ end bind
203
+ end bind
204
+ end strategy
205
+
206
+ strategy row6 of type Row 6 is
207
+ bind tail of type Row 5 from row5 in
208
+ bind head of type Int8 from any in
209
+ one of Cell record{head = head, tail = tail}
210
+ end bind
211
+ end bind
212
+ end strategy
213
+
214
+ strategy row7 of type Row 7 is
215
+ bind tail of type Row 6 from row6 in
216
+ bind head of type Int8 from any in
217
+ one of Cell record{head = head, tail = tail}
218
+ end bind
219
+ end bind
220
+ end strategy
221
+
222
+ strategy perfect0 of type Perfect 0 is
223
+ bind value of type Int8 from any in
224
+ one of Leaf value
225
+ end bind
226
+ end strategy
227
+
228
+ strategy perfect1 of type Perfect 1 is
229
+ bind left of type Perfect 0 from perfect0 in
230
+ bind right of type Perfect 0 from perfect0 in
231
+ one of Node record{left = left, right = right}
232
+ end bind
233
+ end bind
234
+ end strategy
235
+
236
+ strategy perfect2 of type Perfect 2 is
237
+ bind left of type Perfect 1 from perfect1 in
238
+ bind right of type Perfect 1 from perfect1 in
239
+ one of Node record{left = left, right = right}
240
+ end bind
241
+ end bind
242
+ end strategy
243
+
244
+ strategy perfect3 of type Perfect 3 is
245
+ bind left of type Perfect 2 from perfect2 in
246
+ bind right of type Perfect 2 from perfect2 in
247
+ one of Node record{left = left, right = right}
248
+ end bind
249
+ end bind
250
+ end strategy
251
+
252
+ strategy grid1by6 of type Grid 6 is
253
+ bind rows of type Row 1 from row1 in
254
+ bind columns of type Row 6 from row6 in
255
+ one of Grid record{rows = rows, columns = columns}
256
+ end bind
257
+ end bind
258
+ end strategy
259
+
260
+ strategy grid2by3 of type Grid 6 is
261
+ bind rows of type Row 2 from row2 in
262
+ bind columns of type Row 3 from row3 in
263
+ one of Grid record{rows = rows, columns = columns}
264
+ end bind
265
+ end bind
266
+ end strategy
267
+
268
+ strategy grid3by2 of type Grid 6 is
269
+ bind rows of type Row 3 from row3 in
270
+ bind columns of type Row 2 from row2 in
271
+ one of Grid record{rows = rows, columns = columns}
272
+ end bind
273
+ end bind
274
+ end strategy
275
+
276
+ strategy grid6by1 of type Grid 6 is
277
+ bind rows of type Row 6 from row6 in
278
+ bind columns of type Row 1 from row1 in
279
+ one of Grid record{rows = rows, columns = columns}
280
+ end bind
281
+ end bind
282
+ end strategy
283
+
284
+ strategy grid6 of type Grid 6 is
285
+ frequency 1 grid1by6, 1 grid2by3, 1 grid3by2, 1 grid6by1
286
+ end strategy
287
+
288
+ strategy row12 of type Row 12 is
289
+ bind value0 of type Int8 from any in
290
+ bind value1 of type Int8 from any in
291
+ bind value2 of type Int8 from any in
292
+ bind value3 of type Int8 from any in
293
+ bind value4 of type Int8 from any in
294
+ bind value5 of type Int8 from any in
295
+ bind value6 of type Int8 from any in
296
+ bind value7 of type Int8 from any in
297
+ bind value8 of type Int8 from any in
298
+ bind value9 of type Int8 from any in
299
+ bind value10 of type Int8 from any in
300
+ bind value11 of type Int8 from any in
301
+ one of (Cell record{head = value0, tail = (Cell record{head = value1, tail = (Cell record{head = value2, tail = (Cell record{head = value3, tail = (Cell record{head = value4, tail = (Cell record{head = value5, tail = (Cell record{head = value6, tail = (Cell record{head = value7, tail = (Cell record{head = value8, tail = (Cell record{head = value9, tail = (Cell record{head = value10, tail = (Cell record{head = value11, tail = End})})})})})})})})})})})})
302
+ end bind
303
+ end bind
304
+ end bind
305
+ end bind
306
+ end bind
307
+ end bind
308
+ end bind
309
+ end bind
310
+ end bind
311
+ end bind
312
+ end bind
313
+ end bind
314
+ end strategy
315
+
316
+ strategy grid1by12 of type Grid 12 is
317
+ bind rows of type Row 1 from row1 in
318
+ bind columns of type Row 12 from row12 in
319
+ one of Grid record{rows = rows, columns = columns}
320
+ end bind
321
+ end bind
322
+ end strategy
323
+
324
+ strategy grid2by6 of type Grid 12 is
325
+ bind rows of type Row 2 from row2 in
326
+ bind columns of type Row 6 from row6 in
327
+ one of Grid record{rows = rows, columns = columns}
328
+ end bind
329
+ end bind
330
+ end strategy
331
+
332
+ strategy grid3by4 of type Grid 12 is
333
+ bind rows of type Row 3 from row3 in
334
+ bind columns of type Row 4 from row4 in
335
+ one of Grid record{rows = rows, columns = columns}
336
+ end bind
337
+ end bind
338
+ end strategy
339
+
340
+ strategy grid4by3 of type Grid 12 is
341
+ bind rows of type Row 4 from row4 in
342
+ bind columns of type Row 3 from row3 in
343
+ one of Grid record{rows = rows, columns = columns}
344
+ end bind
345
+ end bind
346
+ end strategy
347
+
348
+ strategy grid6by2 of type Grid 12 is
349
+ bind rows of type Row 6 from row6 in
350
+ bind columns of type Row 2 from row2 in
351
+ one of Grid record{rows = rows, columns = columns}
352
+ end bind
353
+ end bind
354
+ end strategy
355
+
356
+ strategy grid12by1 of type Grid 12 is
357
+ bind rows of type Row 12 from row12 in
358
+ bind columns of type Row 1 from row1 in
359
+ one of Grid record{rows = rows, columns = columns}
360
+ end bind
361
+ end bind
362
+ end strategy
363
+
364
+ strategy grid12 of type Grid 12 is
365
+ frequency 1 grid1by12, 1 grid2by6, 1 grid3by4, 1 grid4by3, 1 grid6by2, 1
366
+ grid12by1
367
+ end strategy
368
+
369
+ strategy equalHalves of type Halves 6 is
370
+ bind front of type Row 3 from row3 in
371
+ bind back of type Row 3 from row3 in
372
+ one of Halves record{front = front, back = back}
373
+ end bind
374
+ end bind
375
+ end strategy
376
+
377
+ strategy pairs4 of type Pairs 2 is
378
+ bind row of type Row 4 from row4 in
379
+ one of Pairs row
380
+ end bind
381
+ end strategy
382
+
383
+ strategy pairs5 of type Pairs 2 is
384
+ bind row of type Row 5 from row5 in
385
+ one of Pairs row
386
+ end bind
387
+ end strategy
388
+
389
+ strategy twoPairs of type Pairs 2 is frequency 1 pairs4, 1 pairs5 end strategy
390
+
391
+ strategy rest3 of type Rest 3 is
392
+ bind row of type Row 4 from row4 in
393
+ one of Rest row
394
+ end bind
395
+ end strategy
396
+
397
+ for law "|mirror agrees with the proved definition|
398
+ use perfect3 for tree
399
+ end for law
400
+ for law "|mirroring keeps the height|
401
+ use perfect3 for tree
402
+ end for law
403
+ for law "|transposing keeps the area|
404
+ use grid12 for grid
405
+ end for law
406
+ for law "|stacking doubles the area|
407
+ use grid6 for grid
408
+ end for law
409
+ for law "|a grid of six cells|
410
+ use grid6 for grid
411
+ end for law
412
+ for law "|the area is the index|
413
+ use grid12 for grid
414
+ end for law
415
+ for law "|halves of six|
416
+ use equalHalves for halves
417
+ end for law
418
+ for law "|seven elements make three pairs|
419
+ use row7 for xs
420
+ end for law
421
+ for law "|two pairs|
422
+ use twoPairs for p
423
+ end for law
424
+ for law "|the rest of three|
425
+ use rest3 for r
426
+ end for law
427
+
428
+ end harness
429
+ end unit