lawspec 0.25.0 → 0.27.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.
- package/CHANGELOG.md +109 -1
- package/NORMALIZATION-LICENSES.txt +296 -0
- package/README.md +13 -4
- package/api.mjs +0 -8
- package/bin/lawspec.mjs +114 -79
- package/build.json +99 -117
- package/core.wasm +2 -2
- package/core_jsffi.js +5 -0
- package/doctor.mjs +14 -4
- package/examples/native-payments/clojure/lawspec.json +1 -1
- package/examples/native-payments/csharp/lawspec.json +1 -1
- package/examples/native-payments/elixir/lawspec.json +1 -1
- package/examples/native-payments/erlang/lawspec.json +1 -1
- package/examples/native-payments/fsharp/lawspec.json +1 -1
- package/examples/native-payments/gleam/lawspec.json +1 -1
- package/examples/native-payments/go/lawspec.json +1 -1
- package/examples/native-payments/groovy/lawspec.json +1 -1
- package/examples/native-payments/haskell/lawspec.json +1 -1
- package/examples/native-payments/java/lawspec.json +1 -1
- package/examples/native-payments/javascript/lawspec.json +1 -1
- package/examples/native-payments/kotlin/lawspec.json +1 -1
- package/examples/native-payments/prolog/lawspec.json +20 -0
- package/examples/native-payments/prolog/src/domain/payments.pl +23 -0
- package/examples/native-payments/prolog/tests/domain/payment_generators.pl +17 -0
- package/examples/native-payments/python/lawspec.json +1 -1
- package/examples/native-payments/rust/lawspec.json +1 -1
- package/examples/native-payments/scala/lawspec.json +1 -1
- package/examples/native-payments/swift/lawspec.json +1 -1
- package/examples/native-payments/typescript/lawspec.json +1 -1
- package/examples/packages/orders/lawspec.json +1 -1
- package/examples/packages/orders/orders.lawspec +27 -25
- package/examples/packages/shop-domain/src/domain.lawspec +15 -14
- package/examples/packages/shop-tax-1/src/api.lawspec +1 -0
- package/examples/packages/shop-tax-1/src/rates.lawspec +1 -0
- package/examples/packages/shop-tax-2/src/api.lawspec +1 -0
- package/examples/packages/shop-tax-2/src/rates.lawspec +1 -0
- package/examples/rc1/authorization-snapshots.lawspec +24 -23
- package/examples/rc1/banner-filenames.lawspec +7 -6
- package/examples/rc1/bit-codec.lawspec +12 -11
- package/examples/rc1/bounded-witness-search.lawspec +52 -45
- package/examples/rc1/conflicting-requirements.lawspec +8 -7
- package/examples/rc1/constructive-witnesses.lawspec +40 -33
- package/examples/rc1/documentary-review.lawspec +9 -8
- package/examples/rc1/empty-domains.lawspec +16 -15
- package/examples/rc1/finite-integer-domains.lawspec +24 -23
- package/examples/rc1/law-metadata.lawspec +6 -5
- package/examples/rc1/native-payments.lawspec +17 -16
- package/examples/rc1/nesting/rrr.lawspec +4 -3
- package/examples/rc1/nesting/rru.lawspec +7 -6
- package/examples/rc1/nesting/rur.lawspec +7 -6
- package/examples/rc1/nesting/ruu.lawspec +10 -9
- package/examples/rc1/nesting/urr.lawspec +7 -6
- package/examples/rc1/nesting/uru.lawspec +10 -9
- package/examples/rc1/nesting/uur.lawspec +10 -9
- package/examples/rc1/nesting/uuu.lawspec +13 -12
- package/examples/rc1/order-workflow.lawspec +18 -17
- package/examples/rc1/parcel-measurements.lawspec +14 -13
- package/examples/rc1/picture-records.lawspec +6 -5
- package/examples/rc1/picture-tuples.lawspec +6 -5
- package/examples/rc1/record-payloads.lawspec +12 -11
- package/examples/rc1/recursive-records.lawspec +11 -10
- package/examples/rc1/refund-conformance.lawspec +7 -6
- package/examples/rc1/refund-policy.lawspec +15 -14
- package/examples/rc1/requirement-composition.lawspec +26 -25
- package/examples/rc1/structural-records.lawspec +13 -12
- package/examples/rc1-authoring.lawspec +6 -5
- package/examples/specs/abilities.lawspec +67 -65
- package/examples/specs/ability_imports.lawspec +58 -57
- package/examples/specs/actors.lawspec +23 -22
- package/examples/specs/algebra.lawspec +142 -141
- package/examples/specs/approvals.lawspec +19 -18
- package/examples/specs/async_bindings.lawspec +10 -9
- package/examples/specs/async_fetch.lawspec +12 -11
- package/examples/specs/atoi_codec.lawspec +16 -15
- package/examples/specs/boolean_flags.lawspec +10 -9
- package/examples/specs/builtins.lawspec +73 -72
- package/examples/specs/canonical_url.lawspec +14 -13
- package/examples/specs/collections.lawspec +153 -154
- package/examples/specs/composition.lawspec +70 -66
- package/examples/specs/concurrent_collections.lawspec +8 -7
- package/examples/specs/consistency.lawspec +4 -3
- package/examples/specs/contracts.lawspec +80 -79
- package/examples/specs/crypto.lawspec +26 -25
- package/examples/specs/ctc.lawspec +148 -0
- package/examples/specs/currying.lawspec +32 -31
- package/examples/specs/data_types.lawspec +50 -49
- package/examples/specs/distribution.lawspec +57 -56
- package/examples/specs/domain_modeling.lawspec +68 -47
- package/examples/specs/durations.lawspec +39 -38
- package/examples/specs/equivalent.lawspec +25 -24
- package/examples/specs/failures.lawspec +64 -63
- package/examples/specs/finite_data.lawspec +32 -31
- package/examples/specs/flow_stack.lawspec +64 -63
- package/examples/specs/gadt_expressions.lawspec +50 -49
- package/examples/specs/generation.lawspec +115 -114
- package/examples/specs/handler_bindings.lawspec +42 -40
- package/examples/specs/handles.lawspec +2 -1
- package/examples/specs/harness.lawspec +45 -43
- package/examples/specs/harness_testing.lawspec +18 -13
- package/examples/specs/indexed_arithmetic.lawspec +401 -126
- package/examples/specs/indexed_families.lawspec +182 -66
- package/examples/specs/keywords.lawspec +22 -21
- package/examples/specs/limits.lawspec +7 -6
- package/examples/specs/list_contracts.lawspec +121 -120
- package/examples/specs/list_refinements.lawspec +43 -42
- package/examples/specs/lists.lawspec +45 -44
- package/examples/specs/matchers.lawspec +79 -78
- package/examples/specs/matching.lawspec +43 -42
- package/examples/specs/mixed_inputs.lawspec +25 -24
- package/examples/specs/models.lawspec +44 -43
- package/examples/specs/parse_port.lawspec +28 -27
- package/examples/specs/payments.lawspec +55 -54
- package/examples/specs/railway.lawspec +59 -58
- package/examples/specs/records.lawspec +149 -148
- package/examples/specs/records_inner.lawspec +5 -4
- package/examples/specs/recursive_refinements.lawspec +30 -29
- package/examples/specs/refined_definitions.lawspec +24 -23
- package/examples/specs/refinements.lawspec +58 -57
- package/examples/specs/resilience.lawspec +161 -160
- package/examples/specs/resources.lawspec +61 -60
- package/examples/specs/scalar_adapters.lawspec +60 -59
- package/examples/specs/scalar_catalog.lawspec +165 -164
- package/examples/specs/scalars.lawspec +78 -77
- package/examples/specs/scheduling_order.lawspec +8 -7
- package/examples/specs/scheduling_overlap.lawspec +5 -4
- package/examples/specs/sequences.lawspec +66 -65
- package/examples/specs/sessions.lawspec +13 -12
- package/examples/specs/slug.lawspec +16 -15
- package/examples/specs/sum_refinements.lawspec +42 -41
- package/examples/specs/tables.lawspec +29 -28
- package/examples/specs/total_functions.lawspec +71 -70
- package/examples/specs/workflows.lawspec +101 -100
- package/examples-command.mjs +7 -7
- package/explain.mjs +6 -4
- package/expression-presentation.mjs +8 -8
- package/files.mjs +1 -1
- package/index.d.ts +10 -528
- package/launcher.mjs +9 -2
- package/lsp.mjs +10 -6
- package/native-evidence.mjs +25 -12
- package/native-examples.mjs +3 -3
- package/package.json +2 -1
- package/starter-rc1.lawspec +6 -5
- package/starter.lawspec +16 -15
- package/templates.mjs +88 -5
- package/test-command.mjs +40 -4
- package/migrate.mjs +0 -135
- package/migration-bindings.mjs +0 -86
- package/migration-cases.mjs +0 -45
- package/migration-collections.mjs +0 -54
- package/migration-correspondence.mjs +0 -275
- package/migration-generation.mjs +0 -99
- package/migration-laws.mjs +0 -102
- package/migration-records.mjs +0 -166
- package/migration-source.mjs +0 -247
- package/migration-write.mjs +0 -156
|
@@ -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 ::
|
|
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 ::
|
|
13
|
-
| Leaf
|
|
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 ::
|
|
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 ::
|
|
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 ::
|
|
29
|
-
| Pairs
|
|
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 ::
|
|
33
|
-
| Rest
|
|
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) ->
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
definition
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
definition
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
law
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
definition
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
definition
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
definition
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
definition
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
|
139
|
-
definition
|
|
140
|
-
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
law
|
|
145
|
-
definition
|
|
146
|
-
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
law
|
|
151
|
-
definition
|
|
152
|
-
|
|
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
|