pi-fabric 0.93.1 → 0.95.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 (214) hide show
  1. package/LAWS.bend +502 -0
  2. package/PROOF.bend +452 -0
  3. package/README.md +3 -0
  4. package/THIRD_PARTY_NOTICES.md +9 -0
  5. package/dist/agents.js +6 -5
  6. package/dist/agents.js.map +1 -1
  7. package/dist/chunks/{chunk-3TXOQ5MG.js → chunk-3CJETB4S.js} +828 -204
  8. package/dist/chunks/chunk-3CJETB4S.js.map +7 -0
  9. package/dist/chunks/{chunk-SUJ5KLCS.js → chunk-3DUX4PXZ.js} +273 -61
  10. package/dist/chunks/chunk-3DUX4PXZ.js.map +7 -0
  11. package/dist/chunks/{chunk-IUCVOZRX.js → chunk-3SIXBW6A.js} +2 -2
  12. package/dist/chunks/chunk-4E63LJDD.js +468 -0
  13. package/dist/chunks/chunk-4E63LJDD.js.map +7 -0
  14. package/dist/chunks/{chunk-2X3363IK.js → chunk-754HA6KO.js} +2 -2
  15. package/dist/chunks/{chunk-ZDNGXLEC.js → chunk-B4HECUJI.js} +2 -2
  16. package/dist/chunks/{chunk-YDZOEKI6.js → chunk-CRU563MT.js} +2 -2
  17. package/dist/chunks/{chunk-H6DDV6E2.js → chunk-CSJSHBAT.js} +5 -5
  18. package/dist/chunks/{chunk-MW5VI7IW.js → chunk-D4B4CCTA.js} +2 -2
  19. package/dist/chunks/{chunk-EDL4JDW7.js → chunk-EBWMC3OO.js} +2 -2
  20. package/dist/chunks/{chunk-4NUTVNS2.js → chunk-EY57KW52.js} +5 -6
  21. package/dist/chunks/{chunk-7A6NVHB5.js → chunk-FJSHRHOR.js} +7 -4
  22. package/dist/chunks/chunk-FJSHRHOR.js.map +7 -0
  23. package/dist/chunks/{chunk-PSNXUZMY.js → chunk-G2F2RDZI.js} +5 -47
  24. package/dist/chunks/chunk-G2F2RDZI.js.map +7 -0
  25. package/dist/chunks/{chunk-3WIGAX56.js → chunk-JCV54SSP.js} +2 -2
  26. package/dist/chunks/chunk-KS44WKJJ.js +51 -0
  27. package/dist/chunks/chunk-KS44WKJJ.js.map +7 -0
  28. package/dist/chunks/{chunk-UQ7GWC27.js → chunk-LNLQ2LX3.js} +10 -1
  29. package/dist/chunks/chunk-LNLQ2LX3.js.map +7 -0
  30. package/dist/chunks/{chunk-G4LADAYY.js → chunk-OINADFEF.js} +8 -3
  31. package/dist/chunks/chunk-OINADFEF.js.map +7 -0
  32. package/dist/chunks/{chunk-UQ4LTUH4.js → chunk-OUAC6O5C.js} +36 -9
  33. package/dist/chunks/chunk-OUAC6O5C.js.map +7 -0
  34. package/dist/chunks/{chunk-L2U4B5P2.js → chunk-PVSADHF4.js} +8 -8
  35. package/dist/chunks/{chunk-SRZPJBNP.js → chunk-Q5BMTL6A.js} +32 -5
  36. package/dist/chunks/chunk-Q5BMTL6A.js.map +7 -0
  37. package/dist/chunks/{chunk-RTXZHKMS.js → chunk-QNMQJNXE.js} +7 -3
  38. package/dist/chunks/chunk-QNMQJNXE.js.map +7 -0
  39. package/dist/chunks/{chunk-U5FYOMG5.js → chunk-UBPFGMDQ.js} +6 -2
  40. package/dist/chunks/chunk-UBPFGMDQ.js.map +7 -0
  41. package/dist/chunks/{chunk-7VAZ4N43.js → chunk-V3PIO7QL.js} +2 -2
  42. package/dist/chunks/{chunk-MGDLRV2R.js → chunk-VQGO4P7C.js} +2 -2
  43. package/dist/chunks/{chunk-XT4346N7.js → chunk-WXSELMFV.js} +9 -3
  44. package/dist/chunks/chunk-WXSELMFV.js.map +7 -0
  45. package/dist/chunks/{chunk-D5WKZONW.js → chunk-X3IRR7CV.js} +2 -2
  46. package/dist/chunks/{chunk-IJL3QK3J.js → chunk-Y57UHPIK.js} +1 -1
  47. package/dist/chunks/{chunk-IJL3QK3J.js.map → chunk-Y57UHPIK.js.map} +1 -1
  48. package/dist/chunks/{chunk-RKRVOBVO.js → chunk-YYL3APFD.js} +2 -2
  49. package/dist/compaction/bounds.d.ts.map +1 -1
  50. package/dist/compaction/hook.d.ts +2 -0
  51. package/dist/compaction/hook.d.ts.map +1 -1
  52. package/dist/compaction/hook.js +6 -5
  53. package/dist/components/configuration.js +3 -3
  54. package/dist/components/effect-policy.d.ts +2 -0
  55. package/dist/components/effect-policy.d.ts.map +1 -1
  56. package/dist/components/effect-scope.d.ts.map +1 -1
  57. package/dist/components/supervisor.d.ts +1 -1
  58. package/dist/components/supervisor.d.ts.map +1 -1
  59. package/dist/core/action-registry.d.ts +14 -2
  60. package/dist/core/action-registry.d.ts.map +1 -1
  61. package/dist/core/action-registry.js +7 -5
  62. package/dist/core/provider-bindings.d.ts +8 -2
  63. package/dist/core/provider-bindings.d.ts.map +1 -1
  64. package/dist/core/provider-operations.d.ts +28 -0
  65. package/dist/core/provider-operations.d.ts.map +1 -0
  66. package/dist/core/provider-operations.js +201 -0
  67. package/dist/core/provider-operations.js.map +7 -0
  68. package/dist/entropy/index.js +8 -7
  69. package/dist/entropy/normal-form.d.ts.map +1 -1
  70. package/dist/execution-service.d.ts +1 -1
  71. package/dist/execution-service.d.ts.map +1 -1
  72. package/dist/fabric-runtime-state.js +99 -145
  73. package/dist/fabric-runtime-state.js.map +4 -4
  74. package/dist/index.js +21 -25
  75. package/dist/index.js.map +2 -2
  76. package/dist/jev/observation.js +5 -3
  77. package/dist/jev.js +9 -7
  78. package/dist/memory/digest.d.ts.map +1 -1
  79. package/dist/memory/digest.js +2 -1
  80. package/dist/memory/discovery.js +6 -5
  81. package/dist/memory/expand-service.d.ts.map +1 -1
  82. package/dist/memory/file-worker.js +9 -8
  83. package/dist/memory/file-worker.js.map +1 -1
  84. package/dist/memory/index.d.ts.map +1 -1
  85. package/dist/memory/normalize.d.ts.map +1 -1
  86. package/dist/memory/normalize.js +5 -4
  87. package/dist/memory/search.js +7 -6
  88. package/dist/memory/worker-provider.js +10 -9
  89. package/dist/memory.js +9 -8
  90. package/dist/memory.js.map +1 -1
  91. package/dist/mesh/store.d.ts.map +1 -1
  92. package/dist/prewalk/handoff.d.ts +1 -1
  93. package/dist/prewalk/handoff.d.ts.map +1 -1
  94. package/dist/protocol.d.ts +2 -0
  95. package/dist/protocol.d.ts.map +1 -1
  96. package/dist/protocol.js +1 -1
  97. package/dist/providers/jev-provider.js +9 -7
  98. package/dist/providers/memory-provider.js +9 -8
  99. package/dist/residency/host.js +10 -9
  100. package/dist/residency/pi-entry.js +10 -9
  101. package/dist/residency/pi-entry.js.map +1 -1
  102. package/dist/runtime/monty-runtime.js +2 -2
  103. package/dist/runtime/typescript-kernel.js +3 -3
  104. package/dist/schema/controller.d.ts.map +1 -1
  105. package/dist/state/store.d.ts.map +1 -1
  106. package/dist/ui/conversation.js +1 -1
  107. package/dist/ui/dashboard.js +5 -5
  108. package/dist/ui/highlight.d.ts.map +1 -1
  109. package/dist/ui/languages/bend.d.ts +4 -0
  110. package/dist/ui/languages/bend.d.ts.map +1 -0
  111. package/dist/ui/languages/bend.js +73 -0
  112. package/dist/ui/languages/bend.js.map +7 -0
  113. package/dist/ui/settings.js +2 -2
  114. package/dist/ui/shiki-catalog.d.ts +2 -1
  115. package/dist/ui/shiki-catalog.d.ts.map +1 -1
  116. package/dist/verified/authority.d.ts +17 -0
  117. package/dist/verified/authority.d.ts.map +1 -0
  118. package/dist/verified/generated/authority-kernel.d.ts +10 -0
  119. package/dist/verified/generated/authority-kernel.js +116 -0
  120. package/dist/verified/generated/kernel.d.ts +31 -0
  121. package/dist/verified/generated/kernel.js +351 -0
  122. package/dist/verified/generated/lifecycle-kernel.d.ts +7 -0
  123. package/dist/verified/generated/lifecycle-kernel.js +155 -0
  124. package/dist/verified/generated/manifest.json +54 -0
  125. package/dist/verified/generated/provider-kernel.d.ts +9 -0
  126. package/dist/verified/generated/provider-kernel.js +80 -0
  127. package/dist/verified/generated/storage-kernel.d.ts +11 -0
  128. package/dist/verified/generated/storage-kernel.js +98 -0
  129. package/dist/verified/memory.d.ts +11 -0
  130. package/dist/verified/memory.d.ts.map +1 -0
  131. package/dist/verified/nat.d.ts +2 -0
  132. package/dist/verified/nat.d.ts.map +1 -0
  133. package/dist/verified/policy.d.ts +37 -0
  134. package/dist/verified/policy.d.ts.map +1 -0
  135. package/dist/verified/resources.d.ts +14 -0
  136. package/dist/verified/resources.d.ts.map +1 -0
  137. package/dist/verified/storage.d.ts +32 -0
  138. package/dist/verified/storage.d.ts.map +1 -0
  139. package/docs/agents.md +14 -14
  140. package/docs/architecture.md +1 -1
  141. package/docs/compaction.md +2 -2
  142. package/docs/components.md +1 -1
  143. package/docs/configuration.md +5 -5
  144. package/docs/foreman.md +4 -4
  145. package/docs/harnesses.md +3 -3
  146. package/docs/jev.md +10 -10
  147. package/docs/kernels.md +2 -2
  148. package/docs/licenses/bend-apache-2.0.txt +202 -0
  149. package/docs/memory-recall.md +1 -1
  150. package/docs/programmatic-compaction.md +2 -2
  151. package/docs/provider-capabilities.md +197 -0
  152. package/docs/shell-middleware.md +1 -1
  153. package/docs/verified-kernels.md +278 -0
  154. package/package.json +14 -4
  155. package/proofs/abi.json +308 -0
  156. package/proofs/authority-abi.json +7 -0
  157. package/proofs/authority-kernel.bend +23 -0
  158. package/proofs/authority-proof.bend +74 -0
  159. package/proofs/authority-spec.bend +30 -0
  160. package/proofs/authority-state.bend +43 -0
  161. package/proofs/authority-types.d.ts +3 -0
  162. package/proofs/kernel.bend +139 -0
  163. package/proofs/lifecycle-abi.json +3 -0
  164. package/proofs/lifecycle-kernel.bend +11 -0
  165. package/proofs/lifecycle-proof.bend +249 -0
  166. package/proofs/lifecycle-spec.bend +261 -0
  167. package/proofs/lifecycle-types.d.ts +4 -0
  168. package/proofs/lifecycle.bend +119 -0
  169. package/proofs/provider-abi.json +4 -0
  170. package/proofs/provider-kernel.bend +14 -0
  171. package/proofs/provider-plans.bend +28 -0
  172. package/proofs/provider-spec.bend +14 -0
  173. package/proofs/provider-types.d.ts +5 -0
  174. package/proofs/resource-proof.bend +633 -0
  175. package/proofs/resource-spec.bend +133 -0
  176. package/proofs/resources.bend +160 -0
  177. package/proofs/state-kernel.bend +17 -0
  178. package/proofs/state-plans.bend +40 -0
  179. package/proofs/state-proof.bend +42 -0
  180. package/proofs/state-spec.bend +26 -0
  181. package/proofs/storage-abi.json +3 -0
  182. package/proofs/storage-kernel.bend +11 -0
  183. package/proofs/storage-plans.bend +100 -0
  184. package/proofs/storage-proof.bend +176 -0
  185. package/proofs/storage-spec.bend +70 -0
  186. package/proofs/storage-types.d.ts +8 -0
  187. package/proofs/types.d.ts +7 -0
  188. package/scripts/test-verified-kernels.mjs +107 -0
  189. package/scripts/verified-kernels.mjs +136 -0
  190. package/dist/chunks/chunk-3TXOQ5MG.js.map +0 -7
  191. package/dist/chunks/chunk-7A6NVHB5.js.map +0 -7
  192. package/dist/chunks/chunk-G4LADAYY.js.map +0 -7
  193. package/dist/chunks/chunk-PSNXUZMY.js.map +0 -7
  194. package/dist/chunks/chunk-RTXZHKMS.js.map +0 -7
  195. package/dist/chunks/chunk-SRZPJBNP.js.map +0 -7
  196. package/dist/chunks/chunk-SUJ5KLCS.js.map +0 -7
  197. package/dist/chunks/chunk-U5FYOMG5.js.map +0 -7
  198. package/dist/chunks/chunk-UQ4LTUH4.js.map +0 -7
  199. package/dist/chunks/chunk-UQ7GWC27.js.map +0 -7
  200. package/dist/chunks/chunk-XT4346N7.js.map +0 -7
  201. /package/dist/chunks/{chunk-IUCVOZRX.js.map → chunk-3SIXBW6A.js.map} +0 -0
  202. /package/dist/chunks/{chunk-2X3363IK.js.map → chunk-754HA6KO.js.map} +0 -0
  203. /package/dist/chunks/{chunk-ZDNGXLEC.js.map → chunk-B4HECUJI.js.map} +0 -0
  204. /package/dist/chunks/{chunk-YDZOEKI6.js.map → chunk-CRU563MT.js.map} +0 -0
  205. /package/dist/chunks/{chunk-H6DDV6E2.js.map → chunk-CSJSHBAT.js.map} +0 -0
  206. /package/dist/chunks/{chunk-MW5VI7IW.js.map → chunk-D4B4CCTA.js.map} +0 -0
  207. /package/dist/chunks/{chunk-EDL4JDW7.js.map → chunk-EBWMC3OO.js.map} +0 -0
  208. /package/dist/chunks/{chunk-4NUTVNS2.js.map → chunk-EY57KW52.js.map} +0 -0
  209. /package/dist/chunks/{chunk-3WIGAX56.js.map → chunk-JCV54SSP.js.map} +0 -0
  210. /package/dist/chunks/{chunk-L2U4B5P2.js.map → chunk-PVSADHF4.js.map} +0 -0
  211. /package/dist/chunks/{chunk-7VAZ4N43.js.map → chunk-V3PIO7QL.js.map} +0 -0
  212. /package/dist/chunks/{chunk-MGDLRV2R.js.map → chunk-VQGO4P7C.js.map} +0 -0
  213. /package/dist/chunks/{chunk-D5WKZONW.js.map → chunk-X3IRR7CV.js.map} +0 -0
  214. /package/dist/chunks/{chunk-RKRVOBVO.js.map → chunk-YYL3APFD.js.map} +0 -0
package/LAWS.bend ADDED
@@ -0,0 +1,502 @@
1
+ import ./proofs/resources.bend as R
2
+ import ./proofs/resource-spec.bend as RS
3
+ import Base
4
+ import ./proofs/kernel.bend as K
5
+ import ./proofs/state-plans.bend as SP
6
+ import ./proofs/state-spec.bend as SS
7
+ import ./proofs/state-kernel.bend as SK
8
+
9
+ import ./proofs/provider-plans.bend as DP
10
+ import ./proofs/provider-spec.bend as DS
11
+ import ./proofs/provider-kernel.bend as DK
12
+
13
+ import ./proofs/authority-kernel.bend as AK
14
+ import ./proofs/authority-state.bend as A
15
+ import ./proofs/authority-spec.bend as AS
16
+
17
+ law authority_issue_exact:
18
+ for +grants: +List<+List<Nat>>
19
+ {AK.authorityIssue(grants) == A.Active{grants} : A.Authority}
20
+
21
+ law authority_issue_live:
22
+ for +grants: +List<+List<Nat>>
23
+ {AK.authorityLive(AK.authorityIssue(grants)) == True{} : Bool}
24
+
25
+ law authority_use_safe:
26
+ for +authority: A.Authority
27
+ for +grant: +List<Nat>
28
+ for allowed: {AK.authorityAllows(authority, grant) == True{} : Bool}
29
+ AS.CanUse(authority, grant)
30
+
31
+ law authority_use_complete:
32
+ for +authority: A.Authority
33
+ for +grant: +List<Nat>
34
+ for member: AS.CanUse(authority, grant)
35
+ {AK.authorityAllows(authority, grant) == True{} : Bool}
36
+
37
+ law authority_derive_safe:
38
+ for +parent: A.Authority
39
+ for +candidate: +List<+List<Nat>>
40
+ AS.DerivationSafe(parent, candidate, AK.authorityDerive(parent, candidate))
41
+
42
+ law authority_derive_complete:
43
+ for +parent: A.Authority
44
+ for +candidate: +List<+List<Nat>>
45
+ for subset: AS.CanDerive(parent, candidate)
46
+ AS.DerivationAccepted(candidate, AK.authorityDerive(parent, candidate))
47
+
48
+ law authority_child_use_safe:
49
+ for +parent: A.Authority
50
+ for +candidate: +List<+List<Nat>>
51
+ for +grant: +List<Nat>
52
+ for used: {AK.authorityAllows(AK.authorityDerive(parent, candidate), grant) == True{} : Bool}
53
+ AS.CanUse(parent, grant)
54
+
55
+ law authority_released_refused:
56
+ for +authority: A.Authority
57
+ for +grant: +List<Nat>
58
+ {AK.authorityAllows(AK.authorityRelease(authority), grant) == False{} : Bool}
59
+
60
+ law authority_released_cannot_derive:
61
+ for +authority: A.Authority
62
+ for +candidate: +List<+List<Nat>>
63
+ {AK.authorityDerive(AK.authorityRelease(authority), candidate) == A.Released{} : A.Authority}
64
+
65
+ law authority_released_not_live:
66
+ for +authority: A.Authority
67
+ {AK.authorityLive(AK.authorityRelease(authority)) == False{} : Bool}
68
+
69
+ law provider_plan_safe:
70
+ for +ticket: DP.Ticket
71
+ for +key: +List<Nat>
72
+ for +observed: +List<Nat>
73
+ for +stopped: Bool
74
+ DS.Safe(ticket, key, observed, stopped, DP.plan(DK.providerTake(ticket, key, observed, stopped)))
75
+
76
+ law provider_ticket_consumed:
77
+ for +ticket: DP.Ticket
78
+ for +key: +List<Nat>
79
+ for +observed: +List<Nat>
80
+ for +stopped: Bool
81
+ DS.Consumed(ticket, DP.next(DK.providerTake(ticket, key, observed, stopped)))
82
+
83
+ law provider_replay_refused:
84
+ for +ticket: DP.Ticket
85
+ for +key: +List<Nat>
86
+ for +observed: +List<Nat>
87
+ for +stopped: Bool
88
+ for +again: +List<Nat>
89
+ for +revision: +List<Nat>
90
+ {DP.plan(DK.providerTake(DP.next(DK.providerTake(ticket, key, observed, stopped)), again, revision, False{})) == SP.Denied{} : SP.Plan}
91
+
92
+ law provider_revocation_consumes:
93
+ for +ticket: DP.Ticket
94
+ DS.Consumed(ticket, DK.providerRevoke(ticket))
95
+
96
+ law provider_revoked_refused:
97
+ for +ticket: DP.Ticket
98
+ for +key: +List<Nat>
99
+ for +observed: +List<Nat>
100
+ for +stopped: Bool
101
+ {DP.plan(DK.providerTake(DK.providerRevoke(ticket), key, observed, stopped)) == SP.Denied{} : SP.Plan}
102
+
103
+ law provider_canceled_refused:
104
+ for +ticket: DP.Ticket
105
+ for +key: +List<Nat>
106
+ for +observed: +List<Nat>
107
+ {DP.plan(DK.providerTake(ticket, key, observed, True{})) == SP.Denied{} : SP.Plan}
108
+
109
+ law provider_admission_complete:
110
+ for +key: +List<Nat>
111
+ for +revision: +List<Nat>
112
+ for +payload: +List<Nat>
113
+ {DP.plan(DK.providerTake(DP.Ticket{SP.Grant{True{}, key}, revision, payload}, key, revision, False{})) == SP.Write{key, revision, payload} : SP.Plan}
114
+
115
+ law state_read_safe:
116
+ for +grant: SP.Grant
117
+ for +key: +List<Nat>
118
+ for +stopped: Bool
119
+ SS.ReadSafe(grant, key, stopped, SK.stateRead(grant, key, stopped))
120
+
121
+ law state_write_safe:
122
+ for +grant: SP.Grant
123
+ for +key: +List<Nat>
124
+ for +expected: +List<Nat>
125
+ for +observed: +List<Nat>
126
+ for +value: +List<Nat>
127
+ for +stopped: Bool
128
+ SS.WriteSafe(grant, key, expected, observed, value, stopped, SK.stateWrite(grant, key, expected, observed, value, stopped))
129
+
130
+ law state_read_complete:
131
+ for +key: +List<Nat>
132
+ {SK.stateRead(SP.Grant{True{}, key}, key, False{}) == SP.Read{key} : SP.Plan}
133
+
134
+ law state_write_complete:
135
+ for +key: +List<Nat>
136
+ for +revision: +List<Nat>
137
+ for +value: +List<Nat>
138
+ {SK.stateWrite(SP.Grant{True{}, key}, key, revision, revision, value, False{}) == SP.Write{key, revision, value} : SP.Plan}
139
+
140
+ law state_stale_refused:
141
+ for +grant: SP.Grant
142
+ for +key: +List<Nat>
143
+ for +expected: +List<Nat>
144
+ for +observed: +List<Nat>
145
+ for +value: +List<Nat>
146
+ for +stopped: Bool
147
+ for different: {expected != observed : +List<Nat>}
148
+ {SK.stateWrite(grant, key, expected, observed, value, stopped) == SP.Denied{} : SP.Plan}
149
+
150
+ law state_revoked_read:
151
+ for +grant: SP.Grant
152
+ for +key: +List<Nat>
153
+ for +stopped: Bool
154
+ {SK.stateRead(SK.stateRevoke(grant), key, stopped) == SP.Denied{} : SP.Plan}
155
+
156
+ law state_revoked_write:
157
+ for +grant: SP.Grant
158
+ for +key: +List<Nat>
159
+ for +expected: +List<Nat>
160
+ for +observed: +List<Nat>
161
+ for +value: +List<Nat>
162
+ for +stopped: Bool
163
+ {SK.stateWrite(SK.stateRevoke(grant), key, expected, observed, value, stopped) == SP.Denied{} : SP.Plan}
164
+
165
+ law state_canceled_read:
166
+ for +grant: SP.Grant
167
+ for +key: +List<Nat>
168
+ {SK.stateRead(grant, key, True{}) == SP.Denied{} : SP.Plan}
169
+
170
+ law state_canceled_write:
171
+ for +grant: SP.Grant
172
+ for +key: +List<Nat>
173
+ for +expected: +List<Nat>
174
+ for +observed: +List<Nat>
175
+ for +value: +List<Nat>
176
+ {SK.stateWrite(grant, key, expected, observed, value, True{}) == SP.Denied{} : SP.Plan}
177
+
178
+
179
+ # Specification boundary: review changes here independently from implementation.
180
+ # Predicates below spell out requirements rather than importing the kernel's
181
+ # condition builders. Host observations, validators, hashing, CAS, and compiler
182
+ # correctness remain explicit assumptions, not propositions proved here.
183
+
184
+ def AllTrue(xs: +List<Bool>) -> Type:
185
+ match xs:
186
+ case Nil{}:
187
+ Unit
188
+ case Con{h, t}:
189
+ {h == True{} : Bool} & AllTrue(t)
190
+
191
+ def SpanAllowed(+boundary: Nat, span: K.Span) -> Bool:
192
+ match span:
193
+ case K.Span{first, last, paired}:
194
+ Bool.not(paired) || Nat.is_le(boundary, first) || Nat.is_lt(last, boundary)
195
+
196
+ def SpanRequirements(spans: +List<K.Span>, +boundary: Nat) -> +List<Bool>:
197
+ match spans:
198
+ case Nil{}:
199
+ Nil{}
200
+ case Con{h, t}:
201
+ SpanAllowed(boundary, h) <> SpanRequirements(t, boundary)
202
+
203
+ def CutValid(cut: K.Cut) -> Type:
204
+ match cut:
205
+ case K.Cut{eligible, afterPrevious, retained, budget, boundary, spans}:
206
+ {eligible == True{} : Bool} & ({afterPrevious == True{} : Bool} & ({Nat.is_le(retained, budget) == True{} : Bool} & AllTrue(SpanRequirements(spans, boundary))))
207
+
208
+ def ChunkRequirements(chunk: K.Chunk) -> +List<Bool>:
209
+ match chunk:
210
+ case K.Chunk{+start, +end, +total, expectedStart, expectedTotal, length, +complete}:
211
+ [Nat.is_eq(start, expectedStart), Nat.is_eq(total, expectedTotal), Nat.is_le(start, end), Nat.is_le(end, total), Nat.is_eq(length, Nat.sub(end, start)), Bool.not(Bool.xor(complete, Nat.is_eq(end, total))), complete || Nat.is_lt(start, end)]
212
+
213
+ law all_sound:
214
+ for +xs: +List<Bool>
215
+ for p: {K.all(xs) == True{} : Bool}
216
+ AllTrue(xs)
217
+
218
+ law all_complete:
219
+ for +xs: +List<Bool>
220
+ for p: AllTrue(xs)
221
+ {K.all(xs) == True{} : Bool}
222
+
223
+ law footprint_sound:
224
+ for +count: Nat
225
+ for +limit: Nat
226
+ for +valid: Bool
227
+ for p: {K.footprintFits(count, limit, valid) == True{} : Bool}
228
+ AllTrue([valid, Nat.is_le(count, limit)])
229
+
230
+ law unknown_conflict_symmetric:
231
+ for +lu: Bool
232
+ for +luo: Bool
233
+ for +lo: Bool
234
+ for +ru: Bool
235
+ for +ruo: Bool
236
+ for +ro: Bool
237
+ {K.unknownConflict(lu, luo, lo, ru, ruo, ro) == K.unknownConflict(ru, ruo, ro, lu, luo, lo) : Bool}
238
+
239
+ law transition_sound:
240
+ for +retired: Bool
241
+ for +epoch: Bool
242
+ for +owner: Bool
243
+ for +closed: Bool
244
+ for p: {K.transitionCurrent(retired, epoch, owner, closed) == True{} : Bool}
245
+ AllTrue([Bool.not(retired), epoch, owner, Bool.not(closed)])
246
+
247
+ law close_sound:
248
+ for +retiring: Bool
249
+ for +owner: Bool
250
+ for +retained: Bool
251
+ for +inflight: Bool
252
+ for p: {K.canClose(retiring, owner, retained, inflight) == True{} : Bool}
253
+ AllTrue([retiring, Bool.not(owner), Bool.not(retained), Bool.not(inflight)])
254
+
255
+ law cleanup_failure_quarantines:
256
+ for diverted: Bool
257
+ {K.cleanupState(True{}, diverted) == 2 : U32}
258
+
259
+ law span_sound:
260
+ for +boundary: Nat
261
+ for +span: K.Span
262
+ for p: {K.spanSafe(boundary, span) == True{} : Bool}
263
+ {SpanAllowed(boundary, span) == True{} : Bool}
264
+
265
+ law spans_sound:
266
+ for +spans: +List<K.Span>
267
+ for +boundary: Nat
268
+ for p: {K.spansSafe(spans, boundary) == True{} : Bool}
269
+ AllTrue(SpanRequirements(spans, boundary))
270
+
271
+ law cut_sound:
272
+ for +cut: K.Cut
273
+ for p: {K.cutAccepted(cut) == True{} : Bool}
274
+ CutValid(cut)
275
+
276
+ law pointer_sound:
277
+ for +source: Bool
278
+ for +lineage: Bool
279
+ for p: {K.pointerCurrent(source, lineage) == True{} : Bool}
280
+ AllTrue([source, lineage])
281
+
282
+ law chunk_sound:
283
+ for +chunk: K.Chunk
284
+ for p: {K.chunkAccepted(chunk) == True{} : Bool}
285
+ AllTrue(ChunkRequirements(chunk))
286
+
287
+ law coverage_sound:
288
+ for +complete: Bool
289
+ for +truncated: Bool
290
+ for p: {K.coverageComplete(complete, truncated) == True{} : Bool}
291
+ AllTrue([complete, Bool.not(truncated)])
292
+
293
+ law normalization_sound:
294
+ for +canonical: Bool
295
+ for +plan: Bool
296
+ for +changed: Bool
297
+ for +accepted: Bool
298
+ for p: {K.useNormalized(canonical, plan, changed, accepted) == True{} : Bool}
299
+ AllTrue([Bool.not(canonical), plan, changed, accepted])
300
+
301
+ law canonical_identity:
302
+ for plan: Bool
303
+ for changed: Bool
304
+ for accepted: Bool
305
+ {K.useNormalized(True{}, plan, changed, accepted) == False{} : Bool}
306
+
307
+ law pending_without_marker_hidden:
308
+ for sequence: Bool
309
+ for version: Bool
310
+ {K.headReadable(sequence, version, False{}, True{}, False{}) == False{} : Bool}
311
+
312
+ law committed_head_visible:
313
+ for pending: Bool
314
+ for marker: Bool
315
+ {K.headReadable(True{}, True{}, True{}, pending, marker) == True{} : Bool}
316
+
317
+ law certificate_sound:
318
+ for +conditions: +List<Bool>
319
+ for p: {K.certificateAccepted(conditions) == True{} : Bool}
320
+ AllTrue(conditions)
321
+
322
+ law consume_once:
323
+ {K.consume(False{}) == (False{}, False{}) : Bool & Bool}
324
+
325
+ law consume_retires:
326
+ for active: Bool
327
+ {K.consume(active) == (active, False{}) : Bool & Bool}
328
+
329
+ law unknown_conflict_exact:
330
+ for +lu: Bool
331
+ for +luo: Bool
332
+ for +lo: Bool
333
+ for +ru: Bool
334
+ for +ruo: Bool
335
+ for +ro: Bool
336
+ {K.unknownConflict(lu, luo, lo, ru, ruo, ro) == ((lu && (luo || ro)) || (ru && (ruo || lo))) : Bool}
337
+
338
+ law active_lineage_only:
339
+ for member: Bool
340
+ {K.lineageSelected(False{}, member) == member : Bool}
341
+
342
+ law explicit_all_lineages:
343
+ for member: Bool
344
+ {K.lineageSelected(True{}, member) == True{} : Bool}
345
+
346
+ law known_conflict_exact:
347
+ for +shared: Bool
348
+ for +left: Bool
349
+ for +right: Bool
350
+ {K.knownConflict(shared, left, right) == (shared && (left || right)) : Bool}
351
+
352
+ law summary_bounds:
353
+ for +bytes: Nat
354
+ for +byteLimit: Nat
355
+ for +projected: Nat
356
+ for +target: Nat
357
+ for p: {K.summaryWithin(bytes, byteLimit, projected, target) == True{} : Bool}
358
+ AllTrue([Nat.is_le(bytes, byteLimit), Nat.is_le(projected, target)])
359
+
360
+ law sample_accounting:
361
+ for +total: Nat
362
+ for +retained: Nat
363
+ for +omitted: Nat
364
+ for +limit: Nat
365
+ for p: {K.sampleWithin(total, retained, omitted, limit) == True{} : Bool}
366
+ AllTrue([Nat.is_eq(total, Nat.add(retained, omitted)), Nat.is_le(retained, limit)])
367
+
368
+ law head_sound:
369
+ for +sequence: Bool
370
+ for +version: Bool
371
+ for +committed: Bool
372
+ for +pending: Bool
373
+ for +marker: Bool
374
+ for p: {K.headReadable(sequence, version, committed, pending, marker) == True{} : Bool}
375
+ AllTrue([sequence, version, committed || (pending && marker)])
376
+
377
+ # Positive obligations prevent replacing these acceptance decisions with deny-all.
378
+ law footprint_complete:
379
+ for +count: Nat
380
+ for +limit: Nat
381
+ for +valid: Bool
382
+ for p: AllTrue([valid, Nat.is_le(count, limit)])
383
+ {K.footprintFits(count, limit, valid) == True{} : Bool}
384
+
385
+ law transition_complete:
386
+ for +retired: Bool
387
+ for +epoch: Bool
388
+ for +owner: Bool
389
+ for +closed: Bool
390
+ for p: AllTrue([Bool.not(retired), epoch, owner, Bool.not(closed)])
391
+ {K.transitionCurrent(retired, epoch, owner, closed) == True{} : Bool}
392
+
393
+ law close_complete:
394
+ for +retiring: Bool
395
+ for +owner: Bool
396
+ for +retained: Bool
397
+ for +inflight: Bool
398
+ for p: AllTrue([retiring, Bool.not(owner), Bool.not(retained), Bool.not(inflight)])
399
+ {K.canClose(retiring, owner, retained, inflight) == True{} : Bool}
400
+
401
+ law normalization_complete:
402
+ for +canonical: Bool
403
+ for +plan: Bool
404
+ for +changed: Bool
405
+ for +accepted: Bool
406
+ for p: AllTrue([Bool.not(canonical), plan, changed, accepted])
407
+ {K.useNormalized(canonical, plan, changed, accepted) == True{} : Bool}
408
+
409
+ law chunk_complete:
410
+ for +chunk: K.Chunk
411
+ for p: AllTrue(ChunkRequirements(chunk))
412
+ {K.chunkAccepted(chunk) == True{} : Bool}
413
+
414
+ law certificate_complete:
415
+ for +conditions: +List<Bool>
416
+ for p: AllTrue(conditions)
417
+ {K.certificateAccepted(conditions) == True{} : Bool}
418
+
419
+ # Full declarations enter this checker. Candidate production has no authority.
420
+ law resource_refinement:
421
+ for +original: R.Scope
422
+ for +candidate: +List<+List<Nat>>
423
+ RS.Refines(original, K.resourceNormalize(original, candidate))
424
+
425
+ law resource_output_valid:
426
+ for +original: R.Scope
427
+ for +candidate: +List<+List<Nat>>
428
+ RS.OutputValid(K.resourceNormalize(original, candidate))
429
+
430
+ law resource_conflict_exact:
431
+ for +left: R.Scope
432
+ for +right: R.Scope
433
+ for +lo: Bool
434
+ for +ro: Bool
435
+ for p: {K.resourceConflict(left, right, lo, ro) == True{} : Bool}
436
+ RS.Conflicts(left, right, lo, ro)
437
+
438
+ law resource_conflict_complete:
439
+ for +left: R.Scope
440
+ for +right: R.Scope
441
+ for +lo: Bool
442
+ for +ro: Bool
443
+ for p: RS.Conflicts(left, right, lo, ro)
444
+ {K.resourceConflict(left, right, lo, ro) == True{} : Bool}
445
+
446
+ law resource_conflict_preserved:
447
+ for +left: R.Scope
448
+ for +right: R.Scope
449
+ for +lp: +List<+List<Nat>>
450
+ for +rp: +List<+List<Nat>>
451
+ for +lo: Bool
452
+ for +ro: Bool
453
+ for p: {K.resourceConflict(left, right, lo, ro) == True{} : Bool}
454
+ {K.resourceConflict(K.resourceNormalize(left, lp), K.resourceNormalize(right, rp), lo, ro) == True{} : Bool}
455
+
456
+ law resource_precision:
457
+ for +original: +List<+List<Nat>>
458
+ for +candidate: +List<+List<Nat>>
459
+ for quality: RS.Quality(candidate)
460
+ for forward: RS.Subset(original, candidate)
461
+ for backward: RS.Subset(candidate, original)
462
+ {K.resourceNormalize(R.Exact{original}, candidate) == R.Exact{candidate} : R.Scope}
463
+
464
+ law resource_identity:
465
+ for +names: +List<+List<Nat>>
466
+ for quality: RS.Quality(names)
467
+ {K.resourceNormalize(R.Exact{names}, names) == R.Exact{names} : R.Scope}
468
+
469
+ law resource_recheck_idempotent:
470
+ for +original: R.Scope
471
+ for +candidate: +List<+List<Nat>>
472
+ {K.resourceNormalize(K.resourceNormalize(original, candidate), candidate) == K.resourceNormalize(original, candidate) : R.Scope}
473
+
474
+ law resource_groups_exact:
475
+ for +left: +List<R.Effect>
476
+ for +right: +List<R.Effect>
477
+ {K.resourceGroups(left, right) == RS.Groups(left, right) : Bool}
478
+
479
+ law resource_source_refinement:
480
+ for +names: +List<+List<Nat>>
481
+ RS.Refines(R.Exact{names}, K.resourceSource(names))
482
+
483
+ law resource_source_valid:
484
+ for +names: +List<+List<Nat>>
485
+ RS.SourceValid(K.resourceSource(names))
486
+
487
+ law resource_pair_sound:
488
+ for +left: R.Effect
489
+ for +right: R.Effect
490
+ for p: {R.pairConflict(left, right) == True{} : Bool}
491
+ RS.EffectConflicts(left, right)
492
+
493
+ law resource_pair_complete:
494
+ for +left: R.Effect
495
+ for +right: R.Effect
496
+ for p: RS.EffectConflicts(left, right)
497
+ {R.pairConflict(left, right) == True{} : Bool}
498
+
499
+ law resource_source_complete:
500
+ for +names: +List<+List<Nat>>
501
+ for p: RS.SourceValid(R.Exact{names})
502
+ {K.resourceSource(names) == R.Exact{names} : R.Scope}