gdp-wired 0.44.0 → 0.46.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 (133) hide show
  1. package/README.md +58 -7
  2. package/dist/core/bitsets.d.ts +2 -0
  3. package/dist/core/bitsets.js +23 -0
  4. package/dist/core/bmc.js +6 -2
  5. package/dist/core/c/reader.d.ts +9 -1
  6. package/dist/core/c/reader.js +445 -38
  7. package/dist/core/calendar.d.ts +29 -0
  8. package/dist/core/calendar.js +82 -0
  9. package/dist/core/check.js +3 -2
  10. package/dist/core/cli.d.ts +4 -0
  11. package/dist/core/cli.js +335 -39
  12. package/dist/core/compose.js +3 -1
  13. package/dist/core/counts.d.ts +5 -2
  14. package/dist/core/counts.js +335 -88
  15. package/dist/core/cycles.js +8 -1
  16. package/dist/core/cyclic.d.ts +1 -0
  17. package/dist/core/cyclic.js +13 -7
  18. package/dist/core/data-synth.d.ts +3 -0
  19. package/dist/core/data-synth.js +252 -0
  20. package/dist/core/data.d.ts +8 -2
  21. package/dist/core/data.js +1113 -172
  22. package/dist/core/discover.js +3 -1
  23. package/dist/core/draft.d.ts +19 -0
  24. package/dist/core/draft.js +53 -0
  25. package/dist/core/dsl.d.ts +39 -3
  26. package/dist/core/dsl.js +250 -31
  27. package/dist/core/effect-prims.js +2 -2
  28. package/dist/core/effect.d.ts +1 -4
  29. package/dist/core/effect.js +1 -15
  30. package/dist/core/ex/reader.exs +17 -1
  31. package/dist/core/exists.d.ts +16 -1
  32. package/dist/core/exists.js +447 -50
  33. package/dist/core/extract-c.d.ts +2 -0
  34. package/dist/core/extract-c.js +185 -31
  35. package/dist/core/extract-check.d.ts +7 -0
  36. package/dist/core/extract-check.js +115 -3
  37. package/dist/core/extract-ex.js +3 -3
  38. package/dist/core/extract-go-check.d.ts +1 -1
  39. package/dist/core/extract-go-check.js +21 -13
  40. package/dist/core/extract-go.d.ts +1 -0
  41. package/dist/core/extract-go.js +58 -9
  42. package/dist/core/extract-ir.d.ts +1 -0
  43. package/dist/core/extract-ir.js +15 -0
  44. package/dist/core/extract-jvm.d.ts +1 -1
  45. package/dist/core/extract-jvm.js +65 -14
  46. package/dist/core/extract-orm.d.ts +12 -0
  47. package/dist/core/extract-orm.js +244 -0
  48. package/dist/core/extract-print.js +23 -1
  49. package/dist/core/extract-py.d.ts +1 -0
  50. package/dist/core/extract-py.js +4 -4
  51. package/dist/core/extract-rb.js +3 -3
  52. package/dist/core/extract-read.d.ts +25 -0
  53. package/dist/core/extract-read.js +60 -5
  54. package/dist/core/extract-rs.js +22 -20
  55. package/dist/core/extract-shapes.js +22 -0
  56. package/dist/core/extract-sol.d.ts +10 -1
  57. package/dist/core/extract-sol.js +89 -30
  58. package/dist/core/extract-step.d.ts +201 -4
  59. package/dist/core/extract-step.js +1514 -111
  60. package/dist/core/extract-swift.js +24 -13
  61. package/dist/core/extract.d.ts +9 -0
  62. package/dist/core/extract.js +88 -7
  63. package/dist/core/fiber-run.d.ts +5 -0
  64. package/dist/core/fiber-run.js +18 -0
  65. package/dist/core/fresh.d.ts +2 -2
  66. package/dist/core/fresh.js +7 -3
  67. package/dist/core/go/reader.go +7 -1
  68. package/dist/core/infer.d.ts +4 -1
  69. package/dist/core/infer.js +1020 -246
  70. package/dist/core/jvm/JavaReader.java +33 -8
  71. package/dist/core/jvm/Jvm.java +20 -1
  72. package/dist/core/jvm/KtReader.java +59 -6
  73. package/dist/core/laws.d.ts +10 -3
  74. package/dist/core/laws.js +193 -14
  75. package/dist/core/machine.d.ts +16 -3
  76. package/dist/core/machine.js +212 -28
  77. package/dist/core/nonterm.js +14 -1
  78. package/dist/core/orm/harness.js +61 -0
  79. package/dist/core/orm-fixtures/schema.prisma +5 -0
  80. package/dist/core/py/harness.py +260 -21
  81. package/dist/core/py/reader.py +278 -39
  82. package/dist/core/rb/reader.rb +52 -5
  83. package/dist/core/reader-fixtures/README.md +28 -0
  84. package/dist/core/reader-fixtures/c-693042.cpp +8 -0
  85. package/dist/core/reader-fixtures/go-685506.go +14 -0
  86. package/dist/core/reader-fixtures/jvm-724362.kt +8 -0
  87. package/dist/core/reader-fixtures/jvm-737430.kt +7 -0
  88. package/dist/core/reader-fixtures/jvm-765282.kt +3 -0
  89. package/dist/core/reader-fixtures/swift-735726.swift +15 -0
  90. package/dist/core/reader-fixtures/swift-735990.swift +15 -0
  91. package/dist/core/reader-fixtures/swift-739158.swift +4 -0
  92. package/dist/core/reader-fixtures/swift-744834.swift +15 -0
  93. package/dist/core/reader-fixtures/swift-746946.swift +31 -0
  94. package/dist/core/reader-fixtures/typescript-673062.ts.txt +2 -0
  95. package/dist/core/relation.d.ts +1 -1
  96. package/dist/core/relation.js +29 -2
  97. package/dist/core/relational.js +4 -2
  98. package/dist/core/rs/src/main.rs +18 -2
  99. package/dist/core/sample-cache.d.ts +8 -0
  100. package/dist/core/sample-cache.js +46 -0
  101. package/dist/core/security.d.ts +38 -0
  102. package/dist/core/security.js +88 -0
  103. package/dist/core/sol/harness.py +63 -7
  104. package/dist/core/sol-concrete.d.ts +23 -0
  105. package/dist/core/sol-concrete.js +195 -0
  106. package/dist/core/solver.js +8 -5
  107. package/dist/core/swift/Sources/gdp-swiftreader/main.swift +50 -7
  108. package/dist/core/system.d.ts +62 -1
  109. package/dist/core/system.js +263 -4
  110. package/dist/core/transfer.js +39 -9
  111. package/dist/core/translate.js +39 -10
  112. package/dist/core/watch.js +51 -6
  113. package/dist/interchange/check.js +10 -10
  114. package/dist/interchange/format.d.ts +4 -0
  115. package/dist/interchange/format.js +24 -6
  116. package/dist/kernel/cdcl.d.ts +5 -0
  117. package/dist/kernel/cdcl.js +88 -10
  118. package/dist/kernel/epr.js +141 -29
  119. package/dist/kernel/kernel.d.ts +31 -1
  120. package/dist/kernel/kernel.js +391 -101
  121. package/dist/kernel/model-sequence.d.ts +3 -0
  122. package/dist/kernel/model-sequence.js +34 -0
  123. package/dist/kernel/prove.d.ts +30 -1
  124. package/dist/kernel/prove.js +481 -71
  125. package/dist/kernel/reader.d.ts +3 -0
  126. package/dist/kernel/reader.js +101 -14
  127. package/dist/kernel/share.d.ts +1 -0
  128. package/dist/kernel/share.js +27 -0
  129. package/dist/lean-kernel/emit.d.ts +9 -3
  130. package/dist/lean-kernel/emit.js +200 -66
  131. package/dist/lean-kernel/lean-terms.js +5 -0
  132. package/dist/lean-kernel/library.js +10 -10
  133. package/package.json +7 -2
@@ -94,6 +94,12 @@ export type SFunc = {
94
94
  late?: string;
95
95
  };
96
96
  export type SRec = {
97
+ initializers?: string[];
98
+ orm?: {
99
+ framework: 'django' | 'sqlalchemy' | 'prisma' | 'typeorm';
100
+ key: string;
101
+ why?: string;
102
+ };
97
103
  name: string;
98
104
  short: string;
99
105
  fields: {
@@ -108,6 +114,10 @@ export type SRec = {
108
114
  module: string;
109
115
  p: string;
110
116
  rets?: Record<string, SType>;
117
+ cattrs?: Record<string, number | string | boolean | null>;
118
+ mro?: string[] | null;
119
+ declared?: string[];
120
+ classCollections?: Record<string, string>;
111
121
  };
112
122
  export type SModule = {
113
123
  lang: string;
@@ -164,13 +174,16 @@ type Try = {
164
174
  ws: B[];
165
175
  depth: number;
166
176
  };
167
- export type StoreVal = 'int' | 'float' | string[] | {
177
+ export type StoreVal = 'int' | 'float' | 'str' | string[] | {
168
178
  json: Record<string, string | string[]>;
169
179
  };
170
180
  export type StoreDecl = {
181
+ ormSession?: boolean;
171
182
  get?: string[];
172
183
  set?: string[];
173
184
  delete?: string[];
185
+ add?: string[];
186
+ incr?: string[];
174
187
  skip?: string[];
175
188
  value?: 'int' | 'float' | 'str';
176
189
  attrs?: Record<string, null | boolean | number | string>;
@@ -192,10 +205,13 @@ export type StepOptions = {
192
205
  answers?: Record<string, string>;
193
206
  skip?: string[];
194
207
  stores?: Record<string, StoreDecl>;
208
+ effects?: string[];
209
+ stubs?: string[];
195
210
  strict?: boolean;
196
211
  failures?: 'refuse' | 'kept';
197
212
  onError?: 'refuse' | 'discard';
198
213
  domains?: Record<string, 'nat' | 'int'>;
214
+ types?: Record<string, string>;
199
215
  keep?: string[];
200
216
  defaults?: string[];
201
217
  fields?: Record<string, null | boolean | number | string>;
@@ -217,12 +233,19 @@ export type IntTy = {
217
233
  ub?: boolean;
218
234
  mod?: string;
219
235
  };
236
+ type Bits = {
237
+ x: N;
238
+ A: number;
239
+ B: number;
240
+ w: number;
241
+ };
220
242
  type V = {
221
243
  t: 'num';
222
244
  e: N;
223
245
  ty?: IntTy;
224
246
  cmp?: [N, N];
225
247
  slen?: K;
248
+ bits?: Bits;
226
249
  } | {
227
250
  t: 'bool';
228
251
  e: B;
@@ -258,6 +281,7 @@ type V = {
258
281
  store: string;
259
282
  path: string;
260
283
  };
284
+ sink?: boolean;
261
285
  } | {
262
286
  t: 'ext';
263
287
  q: string;
@@ -329,6 +353,30 @@ type CellWrite = {
329
353
  key: K;
330
354
  has: B;
331
355
  vals: Map<string, V>;
356
+ on?: B;
357
+ };
358
+ type Ranking = {
359
+ name: string;
360
+ id: string;
361
+ decl: MapDecl;
362
+ K: {
363
+ op: 'num';
364
+ e: N;
365
+ };
366
+ exists: B;
367
+ view: Map<string, V>;
368
+ cur: Map<string, V>;
369
+ a: N;
370
+ ld: B;
371
+ ord: string;
372
+ rk: string;
373
+ order?: {
374
+ by: (k: K) => {
375
+ e: N;
376
+ desc?: boolean;
377
+ }[];
378
+ sig: string;
379
+ };
332
380
  };
333
381
  type Ptr = {
334
382
  k: 'nil';
@@ -383,6 +431,13 @@ type Obj = {
383
431
  origin: Origin;
384
432
  lazy?: string;
385
433
  moved?: boolean;
434
+ orm?: {
435
+ table: string;
436
+ key: K;
437
+ session?: string;
438
+ loaded?: boolean;
439
+ deleted?: boolean;
440
+ };
386
441
  } | {
387
442
  k: 'map';
388
443
  decl: MapDecl;
@@ -390,6 +445,7 @@ type Obj = {
390
445
  nil?: B;
391
446
  w?: CellWrite;
392
447
  pre?: CellWrite[];
448
+ ew?: CellWrite;
393
449
  origin: Origin;
394
450
  } | {
395
451
  k: 'store';
@@ -412,6 +468,7 @@ type Path = {
412
468
  locks: string[];
413
469
  defers: string[];
414
470
  cont?: true;
471
+ eff?: Map<string, B>;
415
472
  };
416
473
  type Flow = {
417
474
  live?: Path;
@@ -421,6 +478,15 @@ type Flow = {
421
478
  };
422
479
  export type { V as StepValue, Path as StepPath, Obj as StepObj, Ptr as StepPtr };
423
480
  export type Leaf = {
481
+ orm?: {
482
+ rec: string;
483
+ key: string;
484
+ framework: string;
485
+ fields: {
486
+ name: string;
487
+ t: SType;
488
+ }[];
489
+ };
424
490
  t?: SType;
425
491
  name: string;
426
492
  path: string[];
@@ -437,11 +503,13 @@ export type Leaf = {
437
503
  store?: string;
438
504
  tpl?: string;
439
505
  ordered?: boolean;
506
+ str?: boolean;
440
507
  json?: JField[];
441
508
  choice?: boolean;
442
509
  };
443
510
  export type PArg = {
444
511
  k: 'in';
512
+ time?: string;
445
513
  name: string;
446
514
  float?: boolean;
447
515
  sym?: boolean;
@@ -476,6 +544,7 @@ export type Answer = {
476
544
  name: string;
477
545
  none?: string;
478
546
  float?: boolean;
547
+ time?: string;
479
548
  };
480
549
  sort: string;
481
550
  how?: string;
@@ -492,10 +561,13 @@ export type Answer = {
492
561
  m: string;
493
562
  }[];
494
563
  pass?: boolean;
564
+ effect?: boolean;
565
+ quiet?: boolean;
495
566
  };
496
567
  export type StepRead = {
497
568
  ints: Record<string, IntTy>;
498
569
  madeAt?: string;
570
+ naiveUtc?: boolean;
499
571
  model: Model;
500
572
  leaves: Leaf[];
501
573
  args: Record<string, [string, PArg][]>;
@@ -507,13 +579,23 @@ export type StepRead = {
507
579
  stores: Record<string, StoreDecl>;
508
580
  results: Record<string, 'none' | 'scalar' | 'maybe'>;
509
581
  inject?: string[];
582
+ globals?: {
583
+ name: string;
584
+ mod: string;
585
+ }[];
586
+ effectsOf?: Record<string, string[]>;
587
+ inert?: {
588
+ store: string;
589
+ path: string;
590
+ }[];
591
+ edges?: B[];
510
592
  };
511
593
  export type Inferred = {
512
594
  answers: Map<string, SType>;
513
595
  cut: Map<string, string>;
514
596
  };
515
597
  type Tag = {
516
- k: 'skip' | 'answer' | 'strict';
598
+ k: 'skip' | 'answer' | 'strict' | 'effect';
517
599
  arg: string;
518
600
  };
519
601
  type Bound = {
@@ -558,6 +640,21 @@ export declare class Stepper {
558
640
  readonly folds: Fold[];
559
641
  hidden: number;
560
642
  inFold: number;
643
+ drain?: {
644
+ i: N;
645
+ back: boolean;
646
+ entry: Path;
647
+ map?: {
648
+ name: string;
649
+ id: string;
650
+ };
651
+ dir?: boolean;
652
+ empty?: string;
653
+ rank?: Map<string, Ranking>;
654
+ run?: string;
655
+ };
656
+ drainSetup: number;
657
+ drainAgain: boolean;
561
658
  readonly initHeap: Map<string, Obj>;
562
659
  readonly storeMaps: Map<string, {
563
660
  store: string;
@@ -627,6 +724,37 @@ export declare class Stepper {
627
724
  held: (k: K) => B;
628
725
  } | undefined;
629
726
  forStmt(s: SS, p: Path): Flow;
727
+ whileStmt(s: SS, p: Path, back?: boolean): Flow;
728
+ whileRank(s: SS, p: Path): Flow;
729
+ rankOrder(d: Ranking): (k: K) => {
730
+ e: N;
731
+ desc?: boolean;
732
+ }[];
733
+ rankOf(o: Extract<Obj, {
734
+ k: 'map';
735
+ }>, at: SX): Ranking;
736
+ rankLeast(o: Extract<Obj, {
737
+ k: 'map';
738
+ }>, at: SX, where: (k: K) => B, by: (k: K) => {
739
+ e: N;
740
+ desc?: boolean;
741
+ }[]): {
742
+ key: N;
743
+ some: B;
744
+ held: B;
745
+ where: (k: K) => B;
746
+ };
747
+ drainLeast(o: Extract<Obj, {
748
+ k: 'map';
749
+ }>, at: SX, where: (k: K) => B, by: (k: K) => {
750
+ e: N;
751
+ desc?: boolean;
752
+ }[]): {
753
+ key: N;
754
+ some: B;
755
+ held: B;
756
+ where: (k: K) => B;
757
+ };
630
758
  foldExpr(x: SX, p: Path): [V, Path];
631
759
  changedFrom(e: Path, p: Path): boolean;
632
760
  joinSome(ps: Path[], at: {
@@ -734,6 +862,23 @@ export declare class Stepper {
734
862
  some: B;
735
863
  held: B;
736
864
  }, d: V | undefined, x: SX, p: Path): [V, Path];
865
+ timeField(v: V, t: SType | undefined, read: boolean, at: {
866
+ p: string;
867
+ text?: string;
868
+ }): V;
869
+ naiveUtc: boolean;
870
+ readonly ormTables: Map<string, {
871
+ id: string;
872
+ decl: MapDecl;
873
+ }>;
874
+ ormTable(rec: string, at: SX, p: Path): {
875
+ id: string;
876
+ decl: MapDecl;
877
+ };
878
+ ormRow(rec: string, key: K, vals: Map<string, V>, at: SX, p: Path): [V, Path];
879
+ ormCall(rec: string, op: string, args: V[], kw: [string, V][], at: SX, p: Path): [V, Path];
880
+ ormSession(name: string, op: string, args: V[], kw: [string, V][], at: SX, p: Path): [V, Path];
881
+ ormPersist(v: V, op: string, args: V[], kw: [string, V][], at: SX, p: Path): [V, Path];
737
882
  storeMap(store: string, tpl: string, kn: boolean, at: SX, p: Path): [string, Extract<Obj, {
738
883
  k: 'map';
739
884
  }>];
@@ -747,6 +892,14 @@ export declare class Stepper {
747
892
  readonly storeTypes: Map<string, string>;
748
893
  readonly storeKeyed: Set<string>;
749
894
  readonly injectedFields: string[];
895
+ readonly globalStores: {
896
+ name: string;
897
+ mod: string;
898
+ }[];
899
+ readonly inertAttrs: {
900
+ store: string;
901
+ path: string;
902
+ }[];
750
903
  readonly deps: {
751
904
  name: string;
752
905
  ty?: string;
@@ -802,6 +955,8 @@ export declare class Stepper {
802
955
  isOf(v: V, k: string, at: SX): B;
803
956
  inner(v: V, k: string, at: SX): V;
804
957
  rmw(x: SX, p: Path): [V, Path];
958
+ classConstant(value: number | string | boolean | null, at: SX): V;
959
+ classCollection(owner: string, name: string): V;
805
960
  get(x: SX, p: Path): [V, Path];
806
961
  lazyField(id: string, obj: Extract<Obj, {
807
962
  k: 'rec';
@@ -816,15 +971,20 @@ export declare class Stepper {
816
971
  equal(a: V, b: V, at: SX, p: Path): B;
817
972
  truth(x: SX, p: Path): [B, Path];
818
973
  boolOp(x: SX, p: Path): [V, Path];
819
- fstr(x: SX, p: Path): [V, Path];
974
+ checkOrmDisplay(v: V, at: SX): void;
975
+ fstr(x: SX, p: Path, given?: (string | V)[]): [V, Path];
820
976
  call(x: SX, p: Path, awaited: boolean): [V, Path];
821
977
  argsRead(x: SX, p: Path): Path;
822
978
  evArgs<T>(x: SX, p: Path, k: (args: V[], kw: [string, V][], p: Path) => T): T;
823
979
  dictCall(m: V, name: string, x: SX, p: Path): [V, Path];
824
980
  setCall(m: V, name: string, x: SX, p: Path): [V, Path];
981
+ hasAttribute(v: V, name: string, at: SX, p: Path): boolean;
982
+ initMethod(r: SRec, at: {
983
+ p: string;
984
+ }): string | null | undefined;
825
985
  construct(rec: string, args: V[], kw: [string, V][], x: SX, p: Path): [V, Path];
826
986
  builtin(n: string, x: SX, p: Path): [V, Path];
827
- quotient(d: SX, p: Path, round: 'floor' | 'ceil' | 'trunc' | 'even'): [V, Path];
987
+ quotient(d: SX, p: Path, round: 'floor' | 'ceil' | 'trunc' | 'even' | 'up' | 'away'): [V, Path];
828
988
  lib(q0: string, x: SX, p: Path): [V, Path];
829
989
  readonly edges: B[];
830
990
  readonly lists: MapDecl[];
@@ -894,6 +1054,23 @@ export declare class Stepper {
894
1054
  binop(op: string, a: V, b: V, x: {
895
1055
  p: string;
896
1056
  }, p: Path): V;
1057
+ bitop(op: string, a: Extract<V, {
1058
+ t: 'num';
1059
+ }>, b: Extract<V, {
1060
+ t: 'num';
1061
+ }>, x: {
1062
+ p: string;
1063
+ }): V;
1064
+ ofBits(f: Bits, at: {
1065
+ p: string;
1066
+ }): N;
1067
+ andRuns(v: N, k: number, at: {
1068
+ p: string;
1069
+ }): N;
1070
+ bitsOf(v: N): Bits | undefined;
1071
+ bitGeneric(op: string, v: N, w: N, first: boolean, ty: IntTy, x: {
1072
+ p: string;
1073
+ }): V;
897
1074
  eq(a: V, b: V, x: {
898
1075
  p: string;
899
1076
  }, p?: Path): B;
@@ -959,6 +1136,7 @@ type CellW = {
959
1136
  key: K;
960
1137
  has: B;
961
1138
  vals: Record<string, Term>;
1139
+ each?: true;
962
1140
  };
963
1141
  export declare function padWrites<W extends {
964
1142
  key: K;
@@ -970,6 +1148,24 @@ export declare function iteTerm(c: B, a: Term, b: Term): Term;
970
1148
  type Raw = number | boolean | string;
971
1149
  export declare const node: <T>(id: string) => T;
972
1150
  export declare function asset(rel: string): string;
1151
+ export declare const harnessLimit: () => number;
1152
+ export declare const compileLimit: () => number;
1153
+ export type Built<T> = {
1154
+ ok: T;
1155
+ } | {
1156
+ kind: 'source' | 'harness';
1157
+ why: string;
1158
+ };
1159
+ export declare function buildCheck<T>(tool: string, run: () => T, errorsOf: (e: unknown) => string[], ofSource: (line: string) => boolean, first?: unknown): Built<T>;
1160
+ export declare const builtEvidence: (b: {
1161
+ kind: "source" | "harness";
1162
+ why: string;
1163
+ }) => {
1164
+ source: string;
1165
+ } | {
1166
+ harness: string;
1167
+ };
1168
+ export declare const stopped: (res: Record<string, unknown>) => Record<string, unknown>;
973
1169
  export declare function openHarness(work: string, cmd: string, args: string[], o: Record<string, unknown>): {
974
1170
  child: {
975
1171
  kill: () => void;
@@ -983,6 +1179,7 @@ export type Harness = {
983
1179
  env?: Record<string, string>;
984
1180
  hello: Record<string, unknown>;
985
1181
  error?: string;
1182
+ kind?: 'source' | 'harness';
986
1183
  };
987
1184
  export type StepEvidence = Evidence & {
988
1185
  runMs: number;