capdag 1.361.331 → 1.368.19

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/formal/index.d.ts CHANGED
@@ -1,6 +1,163 @@
1
- // Generated by lungo 1.78.3254 from Lean 4.34.1 for program capdagFormal. Do not edit.
1
+ // Generated by lungo 1.82.64 from Lean 4.34.1 for program capdagFormal. Do not edit.
2
2
  import * as L from "lungo-ts";
3
3
 
4
+ /** Lean's CapDAG.Bifaci.Credit.Gate. */
5
+ export interface Gate {
6
+ readonly available: bigint;
7
+ readonly closed: L.Option<string>;
8
+ }
9
+ export function gateType(): L.Type<Gate>;
10
+
11
+ /** Lean's CapDAG.Bifaci.Credit.Acquire. */
12
+ export type Acquire =
13
+ | { readonly kind: "acquired"; readonly gate: Gate }
14
+ | { readonly kind: "wait" }
15
+ | { readonly kind: "closed"; readonly reason: string }
16
+ ;
17
+ export function acquireType(): L.Type<Acquire>;
18
+
19
+ /** Lean's CapDAG.Bifaci.Credit.Window. */
20
+ export interface Window {
21
+ readonly remaining: bigint;
22
+ readonly pending: bigint;
23
+ readonly batch: bigint;
24
+ }
25
+ export function windowType(): L.Type<Window>;
26
+
27
+ /** Lean's CapDAG.Bifaci.Credit.Arrival. */
28
+ export type CreditArrival =
29
+ | { readonly kind: "accepted"; readonly window: Window }
30
+ | { readonly kind: "violation" }
31
+ ;
32
+ export function creditArrivalType(): L.Type<CreditArrival>;
33
+
34
+ /** Lean's CapDAG.Bifaci.Credit.Granted. */
35
+ export interface Granted {
36
+ readonly window: Window;
37
+ readonly grant: bigint;
38
+ }
39
+ export function grantedType(): L.Type<Granted>;
40
+
41
+ /** Lean's CapDAG.Bifaci.Flow.FrameType. */
42
+ export type FrameType =
43
+ | { readonly kind: "hello" }
44
+ | { readonly kind: "req" }
45
+ | { readonly kind: "chunk" }
46
+ | { readonly kind: "fin" }
47
+ | { readonly kind: "log" }
48
+ | { readonly kind: "err" }
49
+ | { readonly kind: "heartbeat" }
50
+ | { readonly kind: "streamStart" }
51
+ | { readonly kind: "streamEnd" }
52
+ | { readonly kind: "relayNotify" }
53
+ | { readonly kind: "relayState" }
54
+ | { readonly kind: "cancel" }
55
+ | { readonly kind: "credit" }
56
+ | { readonly kind: "closeStream" }
57
+ ;
58
+ export function frameTypeType(): L.Type<FrameType>;
59
+
60
+ /** Lean's CapDAG.Bifaci.Flow.Reorder. */
61
+ export interface Reorder {
62
+ readonly expected: bigint;
63
+ readonly held: Array<bigint>;
64
+ }
65
+ export function reorderType(): L.Type<Reorder>;
66
+
67
+ /** Lean's CapDAG.Bifaci.Flow.Accepted. */
68
+ export type Accepted =
69
+ | { readonly kind: "deliver"; readonly flow: Reorder; readonly seqs: Array<bigint> }
70
+ | { readonly kind: "hold"; readonly flow: Reorder }
71
+ | { readonly kind: "stale" }
72
+ | { readonly kind: "duplicate" }
73
+ | { readonly kind: "overflow" }
74
+ ;
75
+ export function acceptedType(): L.Type<Accepted>;
76
+
77
+ /** Lean's CapDAG.Bifaci.Pools.State. */
78
+ export interface State {
79
+ readonly pools: Array<Pool>;
80
+ readonly queue: Array<Waiter>;
81
+ readonly next: bigint;
82
+ }
83
+ export function stateType(): L.Type<State>;
84
+
85
+ /** Lean's CapDAG.Bifaci.Pools.Waiter. */
86
+ export interface Waiter {
87
+ readonly ticket: bigint;
88
+ readonly chain: Array<string>;
89
+ }
90
+ export function waiterType(): L.Type<Waiter>;
91
+
92
+ /** Lean's CapDAG.Bifaci.Pools.Arrival. */
93
+ export type PoolsArrival =
94
+ | { readonly kind: "admitted"; readonly state: State }
95
+ | { readonly kind: "queued"; readonly state: State; readonly ticket: bigint; readonly position: bigint }
96
+ | { readonly kind: "unknownPool"; readonly name: string }
97
+ ;
98
+ export function poolsArrivalType(): L.Type<PoolsArrival>;
99
+
100
+ /** Lean's CapDAG.Bifaci.Pools.Patience. */
101
+ export type Patience =
102
+ | { readonly kind: "unbounded" }
103
+ | { readonly kind: "atMost"; readonly remaining: bigint }
104
+ | { readonly kind: "exhausted" }
105
+ ;
106
+ export function patienceType(): L.Type<Patience>;
107
+
108
+ /** Lean's CapDAG.Bifaci.Request.Phase. */
109
+ export type Phase =
110
+ | { readonly kind: "created" }
111
+ | { readonly kind: "streaming" }
112
+ ;
113
+ export function phaseType(): L.Type<Phase>;
114
+
115
+ /** Lean's CapDAG.Bifaci.Request.Emitted. */
116
+ export type Emitted =
117
+ | { readonly kind: "streamStart"; readonly stream: string }
118
+ | { readonly kind: "chunk"; readonly stream: string; readonly index: bigint }
119
+ | { readonly kind: "streamEnd"; readonly stream: string; readonly count: L.Option<bigint> }
120
+ | { readonly kind: "fin" }
121
+ | { readonly kind: "err" }
122
+ | { readonly kind: "other" }
123
+ ;
124
+ export function emittedType(): L.Type<Emitted>;
125
+
126
+ /** Lean's CapDAG.Bifaci.Request.Violation. */
127
+ export type Violation =
128
+ | { readonly kind: "afterEnd" }
129
+ | { readonly kind: "streamRestarted"; readonly stream: string }
130
+ | { readonly kind: "streamNotOpen"; readonly stream: string }
131
+ | { readonly kind: "chunkOutOfPlace"; readonly stream: string; readonly expected: bigint; readonly got: bigint }
132
+ | { readonly kind: "chunkCountWrong"; readonly stream: string; readonly sent: bigint; readonly said: bigint }
133
+ | { readonly kind: "endWithOpenStream"; readonly stream: string }
134
+ ;
135
+ export function violationType(): L.Type<Violation>;
136
+
137
+ /** Lean's CapDAG.Bifaci.Request.Disposition. */
138
+ export type Disposition =
139
+ | { readonly kind: "route" }
140
+ | { readonly kind: "straggler" }
141
+ | { readonly kind: "noRoute" }
142
+ ;
143
+ export function dispositionType(): L.Type<Disposition>;
144
+
145
+ /** Lean's CapDAG.Bifaci.Request.Terminal. */
146
+ export type Terminal =
147
+ | { readonly kind: "finished" }
148
+ | { readonly kind: "failed" }
149
+ | { readonly kind: "cancelled" }
150
+ | { readonly kind: "masterDied" }
151
+ ;
152
+ export function terminalType(): L.Type<Terminal>;
153
+
154
+ /** Lean's CapDAG.Bifaci.Request.Write. */
155
+ export type Write =
156
+ | { readonly kind: "send"; readonly ends: boolean }
157
+ | { readonly kind: "suppress" }
158
+ ;
159
+ export function writeType(): L.Type<Write>;
160
+
4
161
  /** Lean's CapDAG.Exec.WfCap. */
5
162
  export interface WfCap {
6
163
  readonly input: Wf;
@@ -19,6 +176,30 @@ export type Effect =
19
176
  ;
20
177
  export function effectType(): L.Type<Effect>;
21
178
 
179
+ /** Lean's CapDAG.Exec.WfQuery. */
180
+ export interface WfQuery {
181
+ readonly input: WfAsk;
182
+ readonly output: WfAsk;
183
+ readonly tags: Wf;
184
+ readonly effect: Effect;
185
+ }
186
+ export function wfQueryType(): L.Type<WfQuery>;
187
+
188
+ /** Lean's TaggedUrn.Exec.Wf, held by handle: only the program's functions make and read its values. */
189
+ export class Wf extends L.Opaque {
190
+ private constructor();
191
+ }
192
+ export function wfType(): L.Type<Wf>;
193
+
194
+ /** Lean's CapDAG.Grade. */
195
+ export type Grade =
196
+ | { readonly kind: "exact" }
197
+ | { readonly kind: "guaranteed" }
198
+ | { readonly kind: "possible" }
199
+ | { readonly kind: "none" }
200
+ ;
201
+ export function gradeType(): L.Type<Grade>;
202
+
22
203
  /** Lean's TaggedUrn.Constraint. */
23
204
  export type Constraint =
24
205
  | { readonly kind: "missing" }
@@ -31,11 +212,22 @@ export type Constraint =
31
212
  ;
32
213
  export function constraintType(): L.Type<Constraint>;
33
214
 
34
- /** Lean's TaggedUrn.Exec.Wf, held by handle: only the program's functions make and read its values. */
35
- export class Wf extends L.Opaque {
36
- private constructor();
215
+ /** Lean's CapDAG.Bifaci.Pools.Pool. */
216
+ export interface Pool {
217
+ readonly name: string;
218
+ readonly capacity: bigint;
219
+ readonly active: bigint;
37
220
  }
38
- export function wfType(): L.Type<Wf>;
221
+ export function poolType(): L.Type<Pool>;
222
+
223
+ /** Lean's CapDAG.Exec.WfAsk. */
224
+ export type WfAsk =
225
+ | { readonly kind: "unknown" }
226
+ | { readonly kind: "within"; readonly u: Wf }
227
+ | { readonly kind: "covers"; readonly u: Wf }
228
+ | { readonly kind: "same"; readonly u: Wf }
229
+ ;
230
+ export function wfAskType(): L.Type<WfAsk>;
39
231
 
40
232
  /** The layout fingerprint and descriptor of each type, by Lean name, for modules using them. */
41
233
  export const leanTypes: {
@@ -45,8 +237,84 @@ export const leanTypes: {
45
237
  /** The Lean program capdagFormal. */
46
238
  export class CapdagFormal {
47
239
  private constructor();
240
+ /** Lean's CapDAG.Bifaci.Credit.Gate.acquire : CapDAG.Bifaci.Credit.Gate → Nat → CapDAG.Bifaci.Credit.Acquire */
241
+ acquire(g: Gate, n: bigint): Acquire;
242
+ /** Lean's CapDAG.Bifaci.Credit.Gate.close : CapDAG.Bifaci.Credit.Gate → String → CapDAG.Bifaci.Credit.Gate */
243
+ close(g: Gate, reason: string): Gate;
244
+ /** Lean's CapDAG.Bifaci.Credit.Gate.grant : CapDAG.Bifaci.Credit.Gate → Nat → CapDAG.Bifaci.Credit.Gate */
245
+ grant(g: Gate, n: bigint): Gate;
246
+ /** Lean's CapDAG.Bifaci.Credit.Gate.opened : Nat → CapDAG.Bifaci.Credit.Gate */
247
+ gateOpened(window: bigint): Gate;
248
+ /** Lean's CapDAG.Bifaci.Credit.Window.arrive : CapDAG.Bifaci.Credit.Window → CapDAG.Bifaci.Credit.Arrival */
249
+ windowArrive(w_: Window): CreditArrival;
250
+ /** Lean's CapDAG.Bifaci.Credit.Window.consume : CapDAG.Bifaci.Credit.Window → CapDAG.Bifaci.Credit.Granted */
251
+ consume(w_: Window): Granted;
252
+ /** Lean's CapDAG.Bifaci.Credit.Window.continued : CapDAG.Bifaci.Credit.Window → CapDAG.Bifaci.Credit.Granted */
253
+ continued(w_: Window): Granted;
254
+ /** Lean's CapDAG.Bifaci.Credit.Window.flush : CapDAG.Bifaci.Credit.Window → CapDAG.Bifaci.Credit.Granted */
255
+ flush(w_: Window): Granted;
256
+ /** Lean's CapDAG.Bifaci.Credit.Window.opened : Nat → CapDAG.Bifaci.Credit.Window */
257
+ windowOpened(window: bigint): Window;
258
+ /** Lean's CapDAG.Bifaci.Credit.grantTarget : List (Option String) → Option String → Option (Option String) */
259
+ grantTarget(streams: Array<L.Option<string>>, named: L.Option<string>): L.Option<L.Option<string>>;
260
+ /** Lean's CapDAG.Bifaci.Credit.negotiate : Nat → Nat → Option Nat */
261
+ negotiate(ours: bigint, theirs: bigint): L.Option<bigint>;
262
+ /** Lean's CapDAG.Bifaci.Flow.FrameType.code : CapDAG.Bifaci.Flow.FrameType → Nat */
263
+ code(a: FrameType): bigint;
264
+ /** Lean's CapDAG.Bifaci.Flow.FrameType.isFlow : CapDAG.Bifaci.Flow.FrameType → Bool */
265
+ isFlow(a: FrameType): boolean;
266
+ /** Lean's CapDAG.Bifaci.Flow.FrameType.isTerminal : CapDAG.Bifaci.Flow.FrameType → Bool */
267
+ isTerminal(a: FrameType): boolean;
268
+ /** Lean's CapDAG.Bifaci.Flow.FrameType.ofCode : Nat → Option CapDAG.Bifaci.Flow.FrameType */
269
+ ofCode(a: bigint): L.Option<FrameType>;
270
+ /** Lean's CapDAG.Bifaci.Flow.Reorder.accept : CapDAG.Bifaci.Flow.Reorder → Nat → Nat → CapDAG.Bifaci.Flow.Accepted */
271
+ accept(r_: Reorder, seq: bigint, limit: bigint): Accepted;
272
+ /** Lean's CapDAG.Bifaci.Flow.Reorder.start : CapDAG.Bifaci.Flow.Reorder */
273
+ start(): Reorder;
274
+ /** Lean's CapDAG.Bifaci.Pools.State.admit : CapDAG.Bifaci.Pools.State → Nat → Option CapDAG.Bifaci.Pools.State */
275
+ admit(s: State, ticket: bigint): L.Option<State>;
276
+ /** Lean's CapDAG.Bifaci.Pools.State.admitNext : CapDAG.Bifaci.Pools.State → Option (CapDAG.Bifaci.Pools.Waiter × CapDAG.Bifaci.Pools.State) */
277
+ admitNext(s: State): L.Option<[Waiter, State]>;
278
+ /** Lean's CapDAG.Bifaci.Pools.State.arrive : CapDAG.Bifaci.Pools.State → List String → CapDAG.Bifaci.Pools.Arrival */
279
+ stateArrive(s: State, chain: Array<string>): PoolsArrival;
280
+ /** Lean's CapDAG.Bifaci.Pools.State.empty : CapDAG.Bifaci.Pools.State */
281
+ empty(): State;
282
+ /** Lean's CapDAG.Bifaci.Pools.State.hasRoom : CapDAG.Bifaci.Pools.State → List String → Bool */
283
+ hasRoom(s: State, chain: Array<string>): boolean;
284
+ /** Lean's CapDAG.Bifaci.Pools.State.heldBack : CapDAG.Bifaci.Pools.State → String → Nat */
285
+ heldBack(s: State, name: string): bigint;
286
+ /** Lean's CapDAG.Bifaci.Pools.State.join : CapDAG.Bifaci.Pools.State → List String → CapDAG.Bifaci.Pools.Arrival */
287
+ join(s: State, chain: Array<string>): PoolsArrival;
288
+ /** Lean's CapDAG.Bifaci.Pools.State.leave : CapDAG.Bifaci.Pools.State → Nat → CapDAG.Bifaci.Pools.State */
289
+ leave(s: State, ticket: bigint): State;
290
+ /** Lean's CapDAG.Bifaci.Pools.State.position : CapDAG.Bifaci.Pools.State → Nat → Nat */
291
+ position(s: State, ticket: bigint): bigint;
292
+ /** Lean's CapDAG.Bifaci.Pools.State.release : CapDAG.Bifaci.Pools.State → List String → CapDAG.Bifaci.Pools.State */
293
+ release(s: State, chain: Array<string>): State;
294
+ /** Lean's CapDAG.Bifaci.Pools.State.setCapacity : CapDAG.Bifaci.Pools.State → String → Nat → CapDAG.Bifaci.Pools.State */
295
+ setCapacity(s: State, name: string, capacity: bigint): State;
296
+ /** Lean's CapDAG.Bifaci.Pools.advertised : Bool → String → Nat → Option Nat → Nat */
297
+ advertised(running: boolean, pool: string, configured: bigint, available: L.Option<bigint>): bigint;
298
+ /** Lean's CapDAG.Bifaci.Pools.chain : String → List (String × List String) → List String */
299
+ chain(cap: string, shared: Array<[string, Array<string>]>): Array<string>;
300
+ /** Lean's CapDAG.Bifaci.Pools.effective : Nat → Option Nat → Nat */
301
+ effective(configured: bigint, available: L.Option<bigint>): bigint;
302
+ /** Lean's CapDAG.Bifaci.Pools.patience : Option Nat → Nat → CapDAG.Bifaci.Pools.Patience */
303
+ patience(unavailableFor: L.Option<bigint>, grace: bigint): Patience;
304
+ /** Lean's CapDAG.Bifaci.Request.Phase.after : CapDAG.Bifaci.Request.Phase → CapDAG.Bifaci.Flow.FrameType → CapDAG.Bifaci.Request.Phase */
305
+ after(p: Phase, frame: FrameType): Phase;
306
+ /** Lean's CapDAG.Bifaci.Request.check : List CapDAG.Bifaci.Request.Emitted → Option CapDAG.Bifaci.Request.Violation */
307
+ check(frames: Array<Emitted>): L.Option<Violation>;
308
+ /** Lean's CapDAG.Bifaci.Request.dispose : Bool → Bool → CapDAG.Bifaci.Request.Disposition */
309
+ dispose(live: boolean, endedLately: boolean): Disposition;
310
+ /** Lean's CapDAG.Bifaci.Request.ledger : Int → CapDAG.Bifaci.Flow.FrameType → Nat → Int */
311
+ ledger(remaining: bigint, frame: FrameType, granted: bigint): bigint;
312
+ /** Lean's CapDAG.Bifaci.Request.terminalOf : CapDAG.Bifaci.Flow.FrameType → Option CapDAG.Bifaci.Request.Terminal */
313
+ terminalOf(a: FrameType): L.Option<Terminal>;
314
+ /** Lean's CapDAG.Bifaci.Request.write : Bool → CapDAG.Bifaci.Flow.FrameType → CapDAG.Bifaci.Request.Write */
315
+ write(over: boolean, frame: FrameType): Write;
48
316
  /** Lean's CapDAG.Exec.accepts : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Bool */
49
- accepts(pattern: WfCap, request: WfCap): boolean;
317
+ accepts(pattern: WfCap, cap: WfCap): boolean;
50
318
  /** Lean's CapDAG.Exec.comparable : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Bool */
51
319
  comparable(a: WfCap, b: WfCap): boolean;
52
320
  /** Lean's CapDAG.Exec.dispatch : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Bool */
@@ -55,6 +323,28 @@ export class CapdagFormal {
55
323
  effectOk(candidate: Effect, request: Effect): boolean;
56
324
  /** Lean's CapDAG.Exec.equivalent : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Bool */
57
325
  equivalent(a: WfCap, b: WfCap): boolean;
326
+ /** Lean's CapDAG.Exec.flows : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Bool */
327
+ flows(a: WfCap, b: WfCap): boolean;
328
+ /** Lean's CapDAG.Exec.mayDispatch : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Bool */
329
+ mayDispatch(candidate: WfCap, request: WfCap): boolean;
330
+ /** Lean's CapDAG.Exec.mayFlow : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Bool */
331
+ mayFlow(a: WfCap, b: WfCap): boolean;
332
+ /** Lean's CapDAG.Exec.queryAdmits : CapDAG.Exec.WfQuery → CapDAG.Exec.WfCap → Bool */
333
+ queryAdmits(q: WfQuery, c: WfCap): boolean;
334
+ /** Lean's CapDAG.Exec.queryBetween : TaggedUrn.Exec.Wf → TaggedUrn.Exec.Wf → TaggedUrn.Exec.Wf → CapDAG.Exec.WfQuery */
335
+ queryBetween(input: Wf, output: Wf, tags: Wf): WfQuery;
336
+ /** Lean's CapDAG.Exec.queryConsuming : TaggedUrn.Exec.Wf → TaggedUrn.Exec.Wf → CapDAG.Exec.WfQuery */
337
+ queryConsuming(input: Wf, tags: Wf): WfQuery;
338
+ /** Lean's CapDAG.Exec.queryGrade : CapDAG.Exec.WfQuery → CapDAG.Exec.WfCap → CapDAG.Grade */
339
+ queryGrade(q: WfQuery, c: WfCap): Grade;
340
+ /** Lean's CapDAG.Exec.queryMayAdmit : CapDAG.Exec.WfQuery → CapDAG.Exec.WfCap → Bool */
341
+ queryMayAdmit(q: WfQuery, c: WfCap): boolean;
342
+ /** Lean's CapDAG.Exec.queryOfPattern : CapDAG.Exec.WfCap → CapDAG.Exec.WfQuery */
343
+ queryOfPattern(p: WfCap): WfQuery;
344
+ /** Lean's CapDAG.Exec.queryOfRequest : CapDAG.Exec.WfCap → CapDAG.Exec.WfQuery */
345
+ queryOfRequest(r_: WfCap): WfQuery;
346
+ /** Lean's CapDAG.Exec.queryProducing : TaggedUrn.Exec.Wf → TaggedUrn.Exec.Wf → CapDAG.Exec.WfQuery */
347
+ queryProducing(output: Wf, tags: Wf): WfQuery;
58
348
  /** Lean's CapDAG.Exec.rankingKey : CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Nat × Nat */
59
349
  rankingKey(candidate: WfCap, request: WfCap): [bigint, bigint];
60
350
  /** Lean's CapDAG.Exec.select : List CapDAG.Exec.WfCap → CapDAG.Exec.WfCap → Option CapDAG.Exec.WfCap */