@fraczak/k 6.1.3 → 6.2.1

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 (80) hide show
  1. package/AGENTS.md +4 -4
  2. package/CLAUDE.md +1 -1
  3. package/DOCS/KIR_SPECIALIZATION_DESIGN.md +11 -2
  4. package/DOCS/KVM_EXECUTION_MODEL.md +413 -0
  5. package/DOCS/OBJECT_FILE_AND_PATTERN.md +6 -0
  6. package/DOCS/REPL.md +22 -17
  7. package/{NAT.k~ → Examples/arithmetics.k} +1 -1
  8. package/Examples/bnat.k +291 -0
  9. package/Examples/byte.k +67 -0
  10. package/Examples/code.k +44 -0
  11. package/Examples/esc.k +9 -0
  12. package/Examples/ieee.k +15766 -0
  13. package/Examples/list.k +7 -0
  14. package/Examples/nat.k +12 -0
  15. package/Examples/vhdl_to_k.k +50 -0
  16. package/README.md +14 -5
  17. package/backend-api.mjs +12 -0
  18. package/codecs/runtime/codec.mjs +1 -0
  19. package/export.mjs +10 -0
  20. package/k-vscode/README.md +10 -1
  21. package/k-vscode/extension.js +273 -0
  22. package/k-vscode/package.json +22 -0
  23. package/k-vscode/syntaxes/k.tmLanguage.json +493 -137
  24. package/k-vscode/test/background-ranges.test.js +50 -0
  25. package/k-vscode/themes/k-contrast-color-theme.json +104 -0
  26. package/kvm.mjs +523 -0
  27. package/package.json +4 -3
  28. package/repl.mjs +43 -2
  29. package/run.mjs +1 -1
  30. package/scripts/run-tests.mjs +55 -0
  31. package/tests/README.md +35 -0
  32. package/{Code-derivation-tests → tests/code-derivation}/codec-witness-pattern.mjs +4 -4
  33. package/{Code-derivation-tests → tests/code-derivation}/convergence-strategy.mjs +1 -1
  34. package/{Code-derivation-tests → tests/code-derivation}/dot.mjs +1 -1
  35. package/{Code-derivation-tests → tests/code-derivation}/filter-syntax.mjs +1 -1
  36. package/{Code-derivation-tests → tests/code-derivation}/index.mjs +1 -1
  37. package/{Code-derivation-tests → tests/code-derivation}/pattern-envelope.mjs +5 -5
  38. package/{Code-derivation-tests → tests/code-derivation}/product.mjs +1 -1
  39. package/{tests.sh → tests/integration.sh} +11 -6
  40. package/{test-fingerprint.mjs → tests/test-fingerprint.mjs} +3 -3
  41. package/{test-hash-fuzz.mjs → tests/test-hash-fuzz.mjs} +1 -1
  42. package/{test-hash-normalization.mjs → tests/test-hash-normalization.mjs} +2 -2
  43. package/{test-ieee-arithmetic.mjs → tests/test-ieee-arithmetic.mjs} +14 -27
  44. package/{test-k-object.mjs → tests/test-k-object.mjs} +8 -8
  45. package/tests/test-kvm.mjs +163 -0
  46. package/{test-repl.mjs → tests/test-repl.mjs} +22 -4
  47. package/{test.mjs → tests/test.mjs} +1 -1
  48. package/.codex +0 -0
  49. package/DOCS/a.html +0 -398
  50. package/DOCS/dependency-graph.html +0 -140
  51. package/DOCS/dependency-graph.md +0 -144
  52. package/UU/ta.k +0 -1
  53. package/UU/ta.k~ +0 -0
  54. package/UU/tb.k +0 -0
  55. package/UU/tc.k +0 -0
  56. package/a.k +0 -138
  57. package/a.klib +0 -1
  58. package/codecs/BINARY_FORMAT.html +0 -471
  59. package/codecs/POLYMORPHIC_BINARY_FORMAT.html +0 -355
  60. package/core.json +0 -1
  61. package/core.klib +0 -1
  62. package/core.klib~ +0 -0
  63. package/ieee.klib +0 -1
  64. package/k-vscode/package-lock.json +0 -4176
  65. package/kkk.k +0 -197
  66. package/kkk.klib +0 -0
  67. package/kkk.klib~ +0 -0
  68. package/nak.klib +0 -1
  69. package/nak2.klib +0 -1
  70. package/nat.k +0 -10
  71. package/nat2.k +0 -9
  72. package/p.json +0 -5475
  73. package/type_registry/registry.mjs~ +0 -105
  74. package/type_registry/typeParser.jison~ +0 -132
  75. /package/{Code-derivation-tests → tests/code-derivation}/blowup.mjs +0 -0
  76. /package/{Code-derivation-tests → tests/code-derivation}/bnat.mjs +0 -0
  77. /package/{Code-derivation-tests → tests/code-derivation}/loop.mjs +0 -0
  78. /package/{Code-derivation-tests → tests/code-derivation}/nat.mjs +0 -0
  79. /package/{Code-derivation-tests → tests/code-derivation}/not-not.mjs +0 -0
  80. /package/{Code-derivation-tests → tests/code-derivation}/rlz.mjs +0 -0
package/kkk.k DELETED
@@ -1,197 +0,0 @@
1
- -- core.k — the k standard core library
2
- --
3
- -- Defines:
4
- -- 1. $bits — the canonical binary number / bit-path type
5
- -- 2. $string — unicode strings (used for labels)
6
- -- 3. $pattern — the type of pattern graphs
7
- -- 4. Basic $bits arithmetic: succ, plus, times
8
-
9
- ---------------------------------------------------------------
10
- -- §1. Bits
11
- ---------------------------------------------------------------
12
-
13
- $ bit = < {} 0, {} 1 >;
14
- b0 = {}|0 $bit;
15
- b1 = {}|1 $bit;
16
-
17
- $ bits = < {} _, bits 0, bits 1 >;
18
-
19
- _ = {}|_;
20
-
21
- 0 = _ |0;
22
- 1 = _ |1;
23
-
24
- inv = {() x, _ r} _inv;
25
- _inv = ${bits x, bits r} < {.x /0 x, .r |0 r} _inv, {.x /1 x, .r |1 r} _inv, .r >;
26
-
27
- concat = ${bits x, bits y} {.x inv x, .y y} concat_;
28
- concat_ = ${bits x, bits y}
29
- <
30
- {.x /0 x, .y |0 y} concat_,
31
- {.x /1 x, .y |1 y} concat_,
32
- .y
33
- >;
34
-
35
- ---------------------------------------------------------------
36
- -- §2. Bits arithmetic
37
- ---------------------------------------------------------------
38
-
39
- -- successor (increment by 1)
40
- succ = {inv x, _ y} _inc;
41
-
42
- _inc = ${bits x, bits y} <
43
- {.x /0 x, .y |1 y} concat_,
44
- {.x /1 x, .y |0 y} _inc,
45
- .y |1
46
- >;
47
-
48
- -- constants
49
- 2 = 1 succ;
50
- 3 = 2 succ;
51
- 4 = 3 succ;
52
- 5 = 4 succ;
53
- 6 = 5 succ;
54
- 7 = 6 succ;
55
- 8 = 7 succ;
56
- 9 = 8 succ;
57
- 10 = 9 succ;
58
-
59
- -- addition on $bits (unsigned, LSB-first with carry)
60
- plus = ${bits x, bits y} {.x inv x, .y inv y, b0 c} _plus;
61
- _plus = ${bits x, bits y, bit c}
62
- <
63
- {.x /_ if, .y /_ and, <.c/0 0, 1> then} .then,
64
- {.x /_ if, .c/0 and, .y then} .then,
65
- {.x y, .y /_|_ x, .c c} _plus,
66
- {<.c/0 0, 1> x, .y y, .x /_ b0 c} _plus,
67
- {.x /0 x, .y /0 y, .c/0 b0 c} _plus |0,
68
- {.x /0 x, .y /0 y, .c/1 b0 c} _plus |1,
69
- {.x /0 x, .y /1 y, .c/0 b0 c} _plus |1,
70
- {.x /0 x, .y /1 y, .c/1 b1 c} _plus |0,
71
- {.x /1 x, .y /0 y, .c/0 b0 c} _plus |1,
72
- {.x /1 x, .y /0 y, .c/1 b1 c} _plus |0,
73
- {.x /1 x, .y /1 y, .c/0 b1 c} _plus |0,
74
- {.x /1 x, .y /1 y, .c/1 b1 c} _plus |1
75
- >;
76
-
77
- -- multiplication on $bits (unsigned, shift-and-add)
78
- times = ${bits x, bits y} {0 result, .x inv _x, .y y} _times;
79
- _times = ${bits result, bits _x, bits y}
80
- <
81
- { .y /_ if, .result then } .then,
82
- {
83
- .result |0 result,
84
- ._x _x,
85
- .y /0 y
86
- } _times,
87
- {
88
- {._x x, .result |0 y, b0 c} _plus result,
89
- ._x _x,
90
- .y /1 y
91
- } _times
92
- >;
93
-
94
- ---------------------------------------------------------------
95
- -- §3. Unicode and String
96
- ---------------------------------------------------------------
97
-
98
- -- 8-bit octet used as a building block for UTF-8 payload pieces.
99
- $ byte = {
100
- bit 0, bit 1, bit 2, bit 3,
101
- bit 4, bit 5, bit 6, bit 7
102
- };
103
-
104
- -- 7-bit ASCII code point payload (U+0000..U+007F).
105
- $ ascii = { bit 6, bit 5, bit 4, bit 3, bit 2, bit 1, bit 0 };
106
-
107
- -- 11-bit payload used for Plane 0 code points U+0080..U+07FF.
108
- -- Plane 0 is the Basic Multilingual Plane (BMP): U+0000..U+FFFF.
109
- $ u0080_07FF = { bit 10, bit 9, bit 8, bit 7, bit 6, bit 5, bit 4, bit 3, bit 2, bit 1, bit 0 };
110
-
111
- -- High-byte classes for common BMP ranges, excluding surrogate/private-use partitions.
112
- -- BMP (Basic Multilingual Plane) is Plane 0: the first 65,536 code points.
113
- $ bmp_hi_common = <
114
- { bit 2, bit 1, bit 0 } h08_0F,
115
- { bit 6, bit 5, bit 4, bit 3, bit 2, bit 1, bit 0 } h10_7F,
116
- { bit 6, bit 5, bit 4, bit 3, bit 2, bit 1, bit 0 } h80_CF,
117
- { bit 2, bit 1, bit 0 } hD0_D7,
118
- {} hF9,
119
- { bit 0 } hFA_FB,
120
- { bit 0 } hFC_FD,
121
- { bit 0 } hFE_FF
122
- >;
123
-
124
- -- High-byte classes for BMP private-use/high-reserved slices.
125
- -- These partitions keep Plane 0 subsets explicit in the type encoding.
126
- $ bmp_hi_private_use = <
127
- { bit 3, bit 2, bit 1, bit 0 } hE0_EF,
128
- { bit 2, bit 1, bit 0 } hF0_F7,
129
- {} hF8
130
- >;
131
-
132
- -- Plane selector for supplementary code points in Planes 2..16.
133
- -- Supplementary planes are all planes above BMP (Plane 0).
134
- $ plane_02_10 = <
135
- { bit 0 } p02_03,
136
- { bit 1, bit 0 } p04_07,
137
- { bit 2, bit 1, bit 0 } p08_0F,
138
- {} p10
139
- >;
140
-
141
- -- Canonical Unicode scalar-value partition used by string encoding.
142
- -- Branch meaning:
143
- -- - ascii: U+0000..U+007F (subset of BMP / Plane 0)
144
- -- - plane0: U+0080..U+07FF (still Plane 0)
145
- -- - bmp_common, bmp_private_use: U+0800..U+FFFF partitions (Plane 0)
146
- -- - supplementary_plane1: U+10000..U+1FFFF (Plane 1)
147
- -- - supplementary_planes2_16: U+20000..U+10FFFF (Planes 2..16)
148
- $ unicode = <
149
- ascii ascii,
150
- u0080_07FF plane0,
151
- { bmp_hi_common hi, byte lo } bmp_common,
152
- { bmp_hi_private_use hi, byte lo } bmp_private_use,
153
- { byte mid, byte lo } supplementary_plane1,
154
- { plane_02_10 plane, byte mid, byte lo } supplementary_planes2_16
155
- >;
156
-
157
- -- Linked-list string: nil or (unicode car, string cdr).
158
- $ string = < {} nil, { unicode car, string cdr } cons >;
159
-
160
- ---------------------------------------------------------------
161
- -- §4. Pattern
162
- ---------------------------------------------------------------
163
-
164
- -- Edge: a labeled edge in a pattern graph.
165
- -- 'label' is the field name or tag name.
166
- -- 'target' is the index (as $bits) of the target node in the pattern list.
167
-
168
- $ edge = { string label, bits target };
169
-
170
- -- Edge list: the edges of a pattern node, sorted by label.
171
-
172
- $ edges = < {} nil, { edge car, edges cdr } cons >;
173
-
174
- -- Pattern node: one of five kinds.
175
- -- "any" is the unconstrained position (...), carrying no edges.
176
- -- The four others carry their edge list directly.
177
-
178
- $ pattern-node = <
179
- {} any,
180
- edges open-product,
181
- edges open-union,
182
- edges closed-product,
183
- edges closed-union
184
- >;
185
-
186
- -- Pattern: a cons-list of pattern nodes.
187
- -- Node 0 (first element) is the root.
188
- -- Edges reference nodes by their index in this list, encoded as $bits.
189
- --
190
- -- The singleton pattern of $pattern itself is a fixed constant.
191
- -- That constant is the implicit framing for all k wire formats:
192
- -- to decode any value, first decode a $pattern under that constant,
193
- -- then decode the value under the pattern just obtained.
194
-
195
- $ pattern = < {} nil, { pattern-node car, pattern cdr } cons >;
196
-
197
- $pattern
package/kkk.klib DELETED
Binary file
package/kkk.klib~ DELETED
Binary file
package/nak.klib DELETED
@@ -1 +0,0 @@
1
- {"format":"k-object","codes":{"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c":{"code":"product","product":{},"def":"$C0={};"},"@w8iSHeQQE738vEmWNGja3FQWk3XuExQKZ2pbm8ApEdkF":{"code":"union","union":{"zero":"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c","succ":"@w8iSHeQQE738vEmWNGja3FQWk3XuExQKZ2pbm8ApEdkF"},"def":"$C0=<C0\"succ\",C1\"zero\">;$C1={};"}},"rels":{"@p5vX3t22gqMxGDRMngp7bGmHwhxZT5hXHFVb862a2kvM":{"def":{"op":"comp","comp":[{"op":"product","product":[],"patterns":[0,1]},{"op":"vid","vid":"zero","patterns":[1,2]}],"patterns":[0,2]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"(...)","fields":[]},{"pattern":"type","type":"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c"},{"pattern":"<...>","fields":["zero"]}],"parent":[]},"edges":[{},{},{"zero":[1]}],"codeId":{"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c":1}}},"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5":{"def":{"op":"comp","comp":[{"op":"product","product":[{"label":"if","exp":{"op":"div","div":"zero","patterns":[2,1]}},{"label":"then","exp":{"op":"identity","patterns":[2,2]}}],"patterns":[2,0]},{"op":"dot","dot":"then","patterns":[0,2]}],"patterns":[2,2]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"{}","fields":["if","then"],"rule":"comp:chain"},{"pattern":"(...)","fields":[]},{"pattern":"<...>","fields":["zero"],"rule":"comp:chain."}],"parent":[]},"edges":[{"if":[1],"then":[2]},{},{"zero":[1]}],"codeId":{}}},"@SwjzXdcxv8ZbpCkF4cXGtgKkqPTfYqGGP5erQE7DCCsj":{"def":{"op":"vid","vid":"succ","patterns":[0,1]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"(...)","fields":[]},{"pattern":"<...>","fields":["succ"]}],"parent":[]},"edges":[{},{"succ":[0]}],"codeId":{}}},"@mKEAm5rV7BDCh244NfCQgYE8wbEqbQMN3dbbPqBPg393":{"def":{"op":"union","union":[{"op":"comp","comp":[{"op":"product","product":[{"label":"x","exp":{"op":"comp","comp":[{"op":"dot","dot":"x","patterns":[0,1]},{"op":"div","div":"succ","patterns":[1,1]}],"patterns":[0,1]}},{"label":"y","exp":{"op":"comp","comp":[{"op":"dot","dot":"y","patterns":[0,2]},{"op":"ref","ref":"@SwjzXdcxv8ZbpCkF4cXGtgKkqPTfYqGGP5erQE7DCCsj","patterns":[2,2]}],"patterns":[0,2]}}],"patterns":[0,0]},{"op":"ref","ref":"@mKEAm5rV7BDCh244NfCQgYE8wbEqbQMN3dbbPqBPg393","patterns":[0,2]}],"patterns":[0,2]},{"op":"dot","dot":"y","patterns":[0,2]}],"patterns":[0,2]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"{}","fields":["x","y"],"rule":"ref:input add(add)"},{"pattern":"<...>","fields":["succ"],"rule":"ref:input add(add)."},{"pattern":"<...>","fields":["succ"],"rule":"ref:input add(add)."}],"parent":[]},"edges":[{"x":[1],"y":[2]},{"succ":[1]},{"succ":[2]}],"codeId":{}}},"@2BBEqu8VuB2NPE89pNNCe9hPbmesi5JFSUQmGgnSRchp":{"def":{"op":"union","union":[{"op":"comp","comp":[{"op":"union","union":[{"op":"comp","comp":[{"op":"dot","dot":"x","patterns":[1,3]},{"op":"ref","ref":"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5","patterns":[3,3]}],"patterns":[1,3]},{"op":"comp","comp":[{"op":"dot","dot":"y","patterns":[1,3]},{"op":"ref","ref":"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5","patterns":[3,3]}],"patterns":[1,3]}],"patterns":[1,3]},{"op":"ref","ref":"@p5vX3t22gqMxGDRMngp7bGmHwhxZT5hXHFVb862a2kvM","patterns":[3,3]}],"patterns":[1,3]},{"op":"comp","comp":[{"op":"product","product":[{"label":"x","exp":{"op":"comp","comp":[{"op":"product","product":[{"label":"x","exp":{"op":"comp","comp":[{"op":"dot","dot":"x","patterns":[1,3]},{"op":"div","div":"succ","patterns":[3,3]}],"patterns":[1,3]}},{"label":"y","exp":{"op":"dot","dot":"y","patterns":[1,3]}}],"patterns":[1,0]},{"op":"ref","ref":"@2BBEqu8VuB2NPE89pNNCe9hPbmesi5JFSUQmGgnSRchp","patterns":[0,3]}],"patterns":[1,3]}},{"label":"y","exp":{"op":"dot","dot":"y","patterns":[1,3]}}],"patterns":[1,0]},{"op":"ref","ref":"@mKEAm5rV7BDCh244NfCQgYE8wbEqbQMN3dbbPqBPg393","patterns":[0,3]}],"patterns":[1,3]}],"patterns":[1,3]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"{}","fields":["x","y"],"rule":"ref:input mult(mult)"},{"pattern":"{...}","fields":["x","y"],"rule":"union:input"},{"pattern":"type","type":"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c"},{"pattern":"<...>","fields":["succ","zero"],"rule":"ref:input mult(add)."}],"parent":[]},"edges":[{"x":[3],"y":[3]},{"x":[3],"y":[3]},{},{"succ":[3],"zero":[2]}],"codeId":{"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c":2}}}},"relAlias":{"zero?":"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5","zero":"@p5vX3t22gqMxGDRMngp7bGmHwhxZT5hXHFVb862a2kvM","succ":"@SwjzXdcxv8ZbpCkF4cXGtgKkqPTfYqGGP5erQE7DCCsj","add":"@mKEAm5rV7BDCh244NfCQgYE8wbEqbQMN3dbbPqBPg393","mult":"@2BBEqu8VuB2NPE89pNNCe9hPbmesi5JFSUQmGgnSRchp","__main__":"@227p5FPVzZxF4qFe77EaaQNFyMPU5xSbpHWz6vaEwmrN"},"compileStats":{"sccs":[{"members":["zero?"],"strategy":"single_pass","iterations":1,"converged":true},{"members":["zero"],"strategy":"single_pass","iterations":1,"converged":true},{"members":["succ"],"strategy":"single_pass","iterations":1,"converged":true},{"members":["add"],"strategy":"fixed_point","iterations":2,"converged":true},{"members":["mult"],"strategy":"fixed_point","iterations":2,"converged":true},{"members":["__main__"],"strategy":"single_pass","iterations":1,"converged":true}],"sccCount":6},"meta":{"@w8iSHeQQE738vEmWNGja3FQWk3XuExQKZ2pbm8ApEdkF":{"type":"code","origins":[{"source":"Examples/nat.k","name":"nat","compiledAt":"2026-05-29T01:54:22.928Z","start":{"line":1,"column":9},"end":{"line":1,"column":30}}]},"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5":{"type":"rel","origins":[{"source":"Examples/nat.k","name":"zero?","compiledAt":"2026-05-29T01:54:22.928Z","start":{"line":3,"column":9},"end":{"line":3,"column":34}}]},"@p5vX3t22gqMxGDRMngp7bGmHwhxZT5hXHFVb862a2kvM":{"type":"rel","origins":[{"source":"Examples/nat.k","name":"zero","compiledAt":"2026-05-29T01:54:22.928Z","start":{"line":2,"column":8},"end":{"line":2,"column":17}}]},"@SwjzXdcxv8ZbpCkF4cXGtgKkqPTfYqGGP5erQE7DCCsj":{"type":"rel","origins":[{"source":"Examples/nat.k","name":"succ","compiledAt":"2026-05-29T01:54:22.928Z","start":{"line":4,"column":8},"end":{"line":4,"column":14}}]},"@mKEAm5rV7BDCh244NfCQgYE8wbEqbQMN3dbbPqBPg393":{"type":"rel","origins":[{"source":"Examples/nat.k","name":"add","compiledAt":"2026-05-29T01:54:22.928Z","start":{"line":5,"column":10},"end":{"line":8,"column":2}}]},"@2BBEqu8VuB2NPE89pNNCe9hPbmesi5JFSUQmGgnSRchp":{"type":"rel","origins":[{"source":"Examples/nat.k","name":"mult","compiledAt":"2026-05-29T01:54:22.928Z","start":{"line":9,"column":8},"end":{"line":12,"column":2}}]}},"main":null}
package/nak2.klib DELETED
@@ -1 +0,0 @@
1
- {"format":"k-object","codes":{"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c":{"code":"product","product":{},"def":"$C0={};"},"@w8iSHeQQE738vEmWNGja3FQWk3XuExQKZ2pbm8ApEdkF":{"code":"union","union":{"succ":"@w8iSHeQQE738vEmWNGja3FQWk3XuExQKZ2pbm8ApEdkF","zero":"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c"},"def":"$C0=<C0\"succ\",C1\"zero\">;$C1={};"}},"rels":{"@p5vX3t22gqMxGDRMngp7bGmHwhxZT5hXHFVb862a2kvM":{"def":{"op":"comp","comp":[{"op":"product","product":[],"patterns":[1,0]},{"op":"vid","vid":"zero","patterns":[0,2]}],"patterns":[1,2]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"type","type":"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c"},{"pattern":"(...)","fields":[],"rule":"comp:chain"},{"pattern":"<...>","fields":["zero"],"rule":"comp:chain"}],"parent":[]},"edges":[{},{},{"zero":[0]}],"codeId":{"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c":0}}},"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5":{"def":{"op":"comp","comp":[{"op":"product","product":[{"label":"if","exp":{"op":"div","div":"zero","patterns":[1,2]}},{"label":"then","exp":{"op":"identity","patterns":[1,1]}}],"patterns":[1,0]},{"op":"dot","dot":"then","patterns":[0,1]}],"patterns":[1,1]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"{}","fields":["if","then"],"rule":"comp:chain"},{"pattern":"<...>","fields":["zero"],"rule":"comp:chain"},{"pattern":"(...)","fields":[],"rule":"comp:chain."}],"parent":[]},"edges":[{"if":[2],"then":[1]},{"zero":[2]},{}],"codeId":{}}},"@SwjzXdcxv8ZbpCkF4cXGtgKkqPTfYqGGP5erQE7DCCsj":{"def":{"op":"vid","vid":"succ","patterns":[1,0]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"<...>","fields":["succ"],"rule":"comp:chain"},{"pattern":"(...)","fields":[],"rule":"comp:chain."}],"parent":[]},"edges":[{"succ":[1]},{}],"codeId":{}}},"@TJpAUPHR8Nch4PrWdXvg6D7qTtJ37vDvYdSkTvg6qX65":{"def":{"op":"union","union":[{"op":"comp","comp":[{"op":"product","product":[{"label":"x","exp":{"op":"comp","comp":[{"op":"dot","dot":"x","patterns":[0,1]},{"op":"div","div":"succ","patterns":[1,1]}],"patterns":[0,1]}},{"label":"y","exp":{"op":"comp","comp":[{"op":"dot","dot":"y","patterns":[0,1]},{"op":"ref","ref":"@SwjzXdcxv8ZbpCkF4cXGtgKkqPTfYqGGP5erQE7DCCsj","patterns":[1,1]}],"patterns":[0,1]}}],"patterns":[0,0]},{"op":"ref","ref":"@TJpAUPHR8Nch4PrWdXvg6D7qTtJ37vDvYdSkTvg6qX65","patterns":[0,1]}],"patterns":[0,1]},{"op":"dot","dot":"y","patterns":[0,1]}],"patterns":[0,1]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"{}","fields":["x","y"],"rule":"comp:chain"},{"pattern":"<...>","fields":["succ"],"rule":"ref:input mKEA(mKEA)."}],"parent":[]},"edges":[{"x":[1],"y":[1]},{"succ":[1]}],"codeId":{}}},"@ELHmpgN5z5NNrDHPffcKRspqmivABSpjM4fbd25TyWw8":{"def":{"op":"union","union":[{"op":"comp","comp":[{"op":"union","union":[{"op":"comp","comp":[{"op":"dot","dot":"x","patterns":[2,3]},{"op":"ref","ref":"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5","patterns":[3,3]}],"patterns":[2,3]},{"op":"comp","comp":[{"op":"dot","dot":"y","patterns":[2,3]},{"op":"ref","ref":"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5","patterns":[3,3]}],"patterns":[2,3]}],"patterns":[2,3]},{"op":"ref","ref":"@p5vX3t22gqMxGDRMngp7bGmHwhxZT5hXHFVb862a2kvM","patterns":[3,3]}],"patterns":[2,3]},{"op":"comp","comp":[{"op":"product","product":[{"label":"x","exp":{"op":"comp","comp":[{"op":"product","product":[{"label":"x","exp":{"op":"comp","comp":[{"op":"dot","dot":"x","patterns":[2,3]},{"op":"div","div":"succ","patterns":[3,3]}],"patterns":[2,3]}},{"label":"y","exp":{"op":"dot","dot":"y","patterns":[2,3]}}],"patterns":[2,0]},{"op":"ref","ref":"@ELHmpgN5z5NNrDHPffcKRspqmivABSpjM4fbd25TyWw8","patterns":[0,3]}],"patterns":[2,3]}},{"label":"y","exp":{"op":"dot","dot":"y","patterns":[2,3]}}],"patterns":[2,0]},{"op":"ref","ref":"@TJpAUPHR8Nch4PrWdXvg6D7qTtJ37vDvYdSkTvg6qX65","patterns":[0,3]}],"patterns":[2,3]}],"patterns":[2,3]},"typeDerivation":{"status":"converged"},"typePatternGraph":{"patterns":{"nodes":[{"pattern":"{}","fields":["x","y"],"rule":"ref:input 2BBE(2BBE)"},{"pattern":"type","type":"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c"},{"pattern":"{...}","fields":["x","y"],"rule":"comp:chain"},{"pattern":"<...>","fields":["succ","zero"],"rule":"ref:input 2BBE(mKEA)."}],"parent":[]},"edges":[{"x":[3],"y":[3]},{},{"x":[3],"y":[3]},{"succ":[3],"zero":[1]}],"codeId":{"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c":1}}}},"relAlias":{"nXXq":"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5","p5vX":"@p5vX3t22gqMxGDRMngp7bGmHwhxZT5hXHFVb862a2kvM","Swjz":"@SwjzXdcxv8ZbpCkF4cXGtgKkqPTfYqGGP5erQE7DCCsj","mKEA":"@TJpAUPHR8Nch4PrWdXvg6D7qTtJ37vDvYdSkTvg6qX65","2BBE":"@ELHmpgN5z5NNrDHPffcKRspqmivABSpjM4fbd25TyWw8","__main__":"@QfyLpmn56wuppuGvrrUJz8LKtgaXfbMtad7RnzBcFk2S"},"compileStats":{"sccs":[{"members":["nXXq"],"strategy":"single_pass","iterations":1,"converged":true},{"members":["p5vX"],"strategy":"single_pass","iterations":1,"converged":true},{"members":["Swjz"],"strategy":"single_pass","iterations":1,"converged":true},{"members":["mKEA"],"strategy":"fixed_point","iterations":1,"converged":true},{"members":["2BBE"],"strategy":"fixed_point","iterations":1,"converged":true},{"members":["__main__"],"strategy":"single_pass","iterations":1,"converged":true}],"sccCount":6},"meta":{"@NiDZqYggx3VZ6b8quBZKTfkgJztWctkesuX4CrhTxM5c":{"type":"code","origins":[{"source":"nat.k","name":"NiDZ","compiledAt":"2026-05-29T01:55:17.693Z","start":{"line":2,"column":10},"end":{"line":2,"column":12}}]},"@w8iSHeQQE738vEmWNGja3FQWk3XuExQKZ2pbm8ApEdkF":{"type":"code","origins":[{"source":"nat.k","name":"w8iS","compiledAt":"2026-05-29T01:55:17.693Z","start":{"line":3,"column":10},"end":{"line":3,"column":38}}]},"@nXXqMAi2PVsBzSN2KidWgg74hYhBbHQt5hw5TgPKvEy5":{"type":"rel","origins":[{"source":"nat.k","name":"nXXq","compiledAt":"2026-05-29T01:55:17.693Z","start":{"line":6,"column":8},"end":{"line":6,"column":71}}]},"@p5vX3t22gqMxGDRMngp7bGmHwhxZT5hXHFVb862a2kvM":{"type":"rel","origins":[{"source":"nat.k","name":"p5vX","compiledAt":"2026-05-29T01:55:17.693Z","start":{"line":5,"column":8},"end":{"line":5,"column":42}}]},"@SwjzXdcxv8ZbpCkF4cXGtgKkqPTfYqGGP5erQE7DCCsj":{"type":"rel","origins":[{"source":"nat.k","name":"Swjz","compiledAt":"2026-05-29T01:55:17.693Z","start":{"line":7,"column":15},"end":{"line":7,"column":20}}]},"@TJpAUPHR8Nch4PrWdXvg6D7qTtJ37vDvYdSkTvg6qX65":{"type":"rel","origins":[{"source":"nat.k","name":"mKEA","compiledAt":"2026-05-29T01:55:17.693Z","start":{"line":8,"column":52},"end":{"line":8,"column":86}}]},"@ELHmpgN5z5NNrDHPffcKRspqmivABSpjM4fbd25TyWw8":{"type":"rel","origins":[{"source":"nat.k","name":"2BBE","compiledAt":"2026-05-29T01:55:17.693Z","start":{"line":9,"column":54},"end":{"line":9,"column":119}}]}},"main":null}
package/nat.k DELETED
@@ -1,10 +0,0 @@
1
- ----- codes -----
2
- $ NiDZ = {};
3
- $ w8iS = < w8iS "succ", NiDZ "zero" >;
4
- ----- rels -----
5
- p5vX = ?(...) {} |zero ?<$NiDZ zero, ...>;
6
- nXXq = ?<(...) zero, ...> {/zero if, () then} .then ?<(...) zero, ...>;
7
- Swjz = ?(...) |succ ?<(...) succ, ...>;
8
- mKEA = ?{<X0 succ, ...>=X0 x, <X1 succ, ...>=X1 y} <{.x /succ x, .y Swjz y} mKEA, .y> ?<X0 succ, ...>=X0;
9
- 2BBE = ?{<X0 succ, $NiDZ zero, ...>=X0 x, X0 y, ...} <<.x nXXq, .y nXXq> p5vX, {{.x /succ x, .y y} 2BBE x, .y y} mKEA> ?<X0 succ, $NiDZ zero, ...>=X0;
10
- ()
package/nat2.k DELETED
@@ -1,9 +0,0 @@
1
- ----- codes -----
2
- $ NiDZ = {};
3
- $ w8iS = < w8iS "succ", NiDZ "zero" >;
4
- ----- rels -----
5
- p5vX = ?(...) {} |zero ?<$NiDZ zero, ...>;
6
- nXXq = ?<(...) zero, ...> {/zero if, () then} .then ?<(...) zero, ...>;
7
- Swjz = ?(...) |succ ?<(...) succ, ...>;
8
- TJpA = ?{<X0 succ, ...>=X0 x, X0 y} <{.x /succ x, .y Swjz y} TJpA, .y> ?<X0 succ, ...>=X0;
9
- ELHm = ?{<X0 succ, $NiDZ zero, ...>=X0 x, X0 y, ...} <<.x nXXq, .y nXXq> p5vX, {{.x /succ x, .y y} ELHm x, .y y} TJpA> ?<X0 succ, $NiDZ zero, ...>=X0;