lawspec 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -1
- package/bin/lawspec.mjs +28 -8
- package/build.json +137 -119
- package/builtin-data-names.mjs +4 -4
- package/core.wasm +2 -2
- package/core_jsffi.js +5 -5
- package/examples/native-payments/elixir/lib/payments_domain.ex +1 -1
- package/examples/native-payments/erlang/src/payments_domain.erl +1 -1
- package/examples/rc1/bit-codec.lawspec +6 -6
- package/examples/rc1/native-payments.lawspec +6 -6
- package/examples/rc1/nesting/rrr.lawspec +2 -2
- package/examples/rc1/nesting/rru.lawspec +4 -4
- package/examples/rc1/nesting/rur.lawspec +4 -4
- package/examples/rc1/nesting/ruu.lawspec +5 -5
- package/examples/rc1/nesting/urr.lawspec +4 -4
- package/examples/rc1/nesting/uru.lawspec +5 -5
- package/examples/rc1/nesting/uur.lawspec +5 -5
- package/examples/rc1/nesting/uuu.lawspec +6 -6
- package/examples/rc1/recursive-records.lawspec +5 -5
- package/examples/rc1/refund-policy.lawspec +4 -0
- package/examples/specs/builtins.lawspec +2 -2
- package/examples/specs/collections.lawspec +8 -8
- package/examples/specs/composition.lawspec +10 -10
- package/examples/specs/contracts.lawspec +2 -2
- package/examples/specs/crypto.lawspec +2 -2
- package/examples/specs/flow_stack.lawspec +4 -4
- package/examples/specs/generation.lawspec +2 -2
- package/examples/specs/list_contracts.lawspec +3 -3
- package/examples/specs/lists.lawspec +6 -6
- package/examples/specs/matching.lawspec +8 -8
- package/examples/specs/payments.lawspec +5 -5
- package/examples/specs/records.lawspec +4 -4
- package/examples/specs/refinements.lawspec +4 -0
- package/examples/specs/resources.lawspec +5 -5
- package/examples/specs/sequences.lawspec +1 -1
- package/examples/specs/sum_refinements.lawspec +11 -11
- package/index.d.ts +154 -3
- package/package.json +1 -1
- package/proof.d.ts +57 -12
- package/proof.mjs +277 -13
|
@@ -47,22 +47,22 @@ end law
|
|
|
47
47
|
|
|
48
48
|
law "|Maybe preserves nested absence| is
|
|
49
49
|
definition : for all (x :: Maybe (Maybe Bool)) => echoMaybe x = x end for all end definition
|
|
50
|
-
example "|outer absence| : x =
|
|
51
|
-
example "|inner absence| : x =
|
|
52
|
-
example "|present| : x =
|
|
50
|
+
example "|outer absence| : x = Absent expect echoMaybe x = Absent end example
|
|
51
|
+
example "|inner absence| : x = Present Absent expect echoMaybe x = Present Absent end example
|
|
52
|
+
example "|present| : x = Present (Present true) expect echoMaybe x = Present (Present true) end example
|
|
53
53
|
end law
|
|
54
54
|
|
|
55
55
|
law "|Either preserves branches| is
|
|
56
56
|
definition : for all (x :: Either (List Int32) (Maybe Bool)) => echoEither x = x end for all end definition
|
|
57
57
|
example "|left list| : x = Left [3, 1, 3] expect echoEither x = Left [3, 1, 3] end example
|
|
58
|
-
example "|right absence| : x = Right
|
|
58
|
+
example "|right absence| : x = Right Absent expect echoEither x = Right Absent end example
|
|
59
59
|
end law
|
|
60
60
|
|
|
61
61
|
law "|nested raw values survive| is
|
|
62
62
|
definition : for all (xs :: List (Maybe (Either CodeUnit16 Bytes))) => echoNested xs = xs end for all end definition
|
|
63
63
|
example "|surrogate and octets| :
|
|
64
|
-
xs = [
|
|
65
|
-
expect echoNested xs = [
|
|
64
|
+
xs = [Absent, Present (Left codeUnit16(55296)), Present (Right bytes([0, 255]))]
|
|
65
|
+
expect echoNested xs = [Absent, Present (Left codeUnit16(55296)), Present (Right bytes([0, 255]))]
|
|
66
66
|
end example
|
|
67
67
|
end law
|
|
68
68
|
end unit
|
|
@@ -15,10 +15,10 @@ law "|nested Maybe patterns preserve each absence state| is
|
|
|
15
15
|
definition :
|
|
16
16
|
for all (value :: Maybe (Maybe Bool)) =>
|
|
17
17
|
(first matching case of value :
|
|
18
|
-
when
|
|
19
|
-
when
|
|
20
|
-
when
|
|
21
|
-
when
|
|
18
|
+
when Absent then Absent
|
|
19
|
+
when Present inner then Present (first matching case of inner :
|
|
20
|
+
when Absent then Absent
|
|
21
|
+
when Present payload then Present payload
|
|
22
22
|
end case)
|
|
23
23
|
end case) = value end for all
|
|
24
24
|
end definition
|
|
@@ -39,11 +39,11 @@ law "|matching can provide a default value| is
|
|
|
39
39
|
definition :
|
|
40
40
|
for all (value :: Maybe Int8) =>
|
|
41
41
|
((first matching case of value :
|
|
42
|
-
when
|
|
43
|
-
when
|
|
42
|
+
when Absent then 0
|
|
43
|
+
when Present payload then payload
|
|
44
44
|
end case) :: Int8) = ((first matching case of value :
|
|
45
|
-
when
|
|
46
|
-
when
|
|
45
|
+
when Present payload then payload
|
|
46
|
+
when Absent then 0
|
|
47
47
|
end case) :: Int8) end for all
|
|
48
48
|
end definition
|
|
49
49
|
end law
|
|
@@ -67,11 +67,11 @@ law "|archives preserve order duplicates and absence| is
|
|
|
67
67
|
expect archive payments = []
|
|
68
68
|
end example
|
|
69
69
|
example "|missing is different from a declined payment| :
|
|
70
|
-
payments = [
|
|
71
|
-
|
|
72
|
-
expect archive payments = [
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
payments = [Absent, Present (Declined ""), Present (Paid (Money record{ amount = 0.1 , currency = USD})),
|
|
71
|
+
Present (Paid (Money record{ amount = 0.1 , currency = USD}))]
|
|
72
|
+
expect archive payments = [Absent, Present (Declined ""),
|
|
73
|
+
Present (Paid (Money record{ amount = 0.1 , currency = USD})),
|
|
74
|
+
Present (Paid (Money record{ amount = 0.1 , currency = USD}))]
|
|
75
75
|
end example
|
|
76
76
|
end law
|
|
77
77
|
end unit
|
|
@@ -89,12 +89,12 @@ end law
|
|
|
89
89
|
|
|
90
90
|
-- A literal takes its type from where it is used: 0 is an Int64 here.
|
|
91
91
|
function opening (a :: Maybe Account) -> Int64 is
|
|
92
|
-
let start = (first matching case of a : when
|
|
92
|
+
let start = (first matching case of a : when Absent then 0 when Present account then account.balance end case) in
|
|
93
93
|
if start < 0 then 0 else start end if end let
|
|
94
94
|
end function
|
|
95
95
|
|
|
96
96
|
law "|an absent account opens at zero| is
|
|
97
|
-
definition : opening
|
|
97
|
+
definition : opening Absent = 0 end definition
|
|
98
98
|
end law
|
|
99
99
|
|
|
100
100
|
-- Recursion on an integer that moves toward a bound is total.
|
|
@@ -164,10 +164,10 @@ law "|a top up stops at the top| is
|
|
|
164
164
|
end definition
|
|
165
165
|
end law
|
|
166
166
|
|
|
167
|
-
law "|a total that overflows is
|
|
167
|
+
law "|a total that overflows is Absent| is
|
|
168
168
|
definition :
|
|
169
169
|
for all (a :: Int32) (b :: Int32) =>
|
|
170
|
-
total a b = (if a + b > Int32.max || a + b < Int32.min then
|
|
170
|
+
total a b = (if a + b > Int32.max || a + b < Int32.min then Absent else Present (prelude.Int32 (a + b)) end if) end for all
|
|
171
171
|
end definition
|
|
172
172
|
end law
|
|
173
173
|
|
|
@@ -42,6 +42,10 @@ law "|bounded input| is
|
|
|
42
42
|
example "|middle| : x = 2 expect positive x = 2 end example
|
|
43
43
|
end law
|
|
44
44
|
|
|
45
|
+
laws for positive are
|
|
46
|
+
partial because "the laws check positive only from 1 to 3"
|
|
47
|
+
end laws
|
|
48
|
+
|
|
45
49
|
law "|large integer| is
|
|
46
50
|
definition : for all (x :: UInt64) => preserve x = x end for all end definition
|
|
47
51
|
example "|maximum UInt64| : x = 18446744073709551615 expect preserve x = 18446744073709551615 end example
|
|
@@ -24,7 +24,7 @@ end resource
|
|
|
24
24
|
|
|
25
25
|
law "|a stored value can be read back| for store :: Store is
|
|
26
26
|
definition :
|
|
27
|
-
for all (k :: Int32) (v :: Int32) => put store k v = unitValue and get store k =
|
|
27
|
+
for all (k :: Int32) (v :: Int32) => put store k v = unitValue and get store k = Present v end for all
|
|
28
28
|
end definition
|
|
29
29
|
example "|the store is open while the case runs| :
|
|
30
30
|
k = 1
|
|
@@ -51,13 +51,13 @@ greeting :: Unit -> Maybe Int32
|
|
|
51
51
|
law "|a note reads back| for dir :: TemporaryDirectory is
|
|
52
52
|
definition :
|
|
53
53
|
for all (n :: Int32) =>
|
|
54
|
-
writeNote (directoryPath dir) n = unitValue and readNote (directoryPath dir) =
|
|
54
|
+
writeNote (directoryPath dir) n = unitValue and readNote (directoryPath dir) = Present n end for all
|
|
55
55
|
end definition
|
|
56
56
|
end law
|
|
57
57
|
|
|
58
58
|
law "|a new directory has no note| for dir :: TemporaryDirectory is
|
|
59
59
|
definition :
|
|
60
|
-
readNote (directoryPath dir) =
|
|
60
|
+
readNote (directoryPath dir) = Absent
|
|
61
61
|
end definition
|
|
62
62
|
end law
|
|
63
63
|
|
|
@@ -69,13 +69,13 @@ end law
|
|
|
69
69
|
|
|
70
70
|
law "|the greeting is the one set| for saved :: SavedEnvironment is
|
|
71
71
|
definition :
|
|
72
|
-
for all (n :: Int32) => setGreeting n = unitValue and greeting unitValue =
|
|
72
|
+
for all (n :: Int32) => setGreeting n = unitValue and greeting unitValue = Present n end for all
|
|
73
73
|
end definition
|
|
74
74
|
end law
|
|
75
75
|
|
|
76
76
|
law "|the environment is restored after each case| for saved :: SavedEnvironment is
|
|
77
77
|
definition :
|
|
78
|
-
greeting unitValue =
|
|
78
|
+
greeting unitValue = Absent
|
|
79
79
|
end definition
|
|
80
80
|
end law
|
|
81
81
|
|
|
@@ -73,7 +73,7 @@ end law
|
|
|
73
73
|
|
|
74
74
|
law "|at reads the item an index names| is
|
|
75
75
|
definition :
|
|
76
|
-
for all (x :: Int32) (xs :: List Int32) => prelude.at 0 (Cons x xs) =
|
|
76
|
+
for all (x :: Int32) (xs :: List Int32) => prelude.at 0 (Cons x xs) = Present x and prelude.at (prelude.length xs + 1) (Cons x xs) = Absent end for all
|
|
77
77
|
end definition
|
|
78
78
|
end law
|
|
79
79
|
|
|
@@ -2,10 +2,10 @@ unit example.sum_refinements
|
|
|
2
2
|
|
|
3
3
|
law "|positive Maybe payloads| is
|
|
4
4
|
definition : for all (x :: Maybe (value :: Int8 where value > 0)) =>
|
|
5
|
-
(first matching case of x : when
|
|
5
|
+
(first matching case of x : when Absent then true when Present payload then payload >= 1 end case) = true end for all
|
|
6
6
|
end definition
|
|
7
|
-
example "|absent| : x =
|
|
8
|
-
example "|present| : x =
|
|
7
|
+
example "|absent| : x = Absent expect x = Absent end example
|
|
8
|
+
example "|present| : x = Present 1 expect x = Present 1 end example
|
|
9
9
|
end law
|
|
10
10
|
|
|
11
11
|
law "|selected Either payload| is
|
|
@@ -19,13 +19,13 @@ end law
|
|
|
19
19
|
|
|
20
20
|
law "|nested Maybe states| is
|
|
21
21
|
definition : for all (x :: Maybe (Maybe (value :: Bool where value))) =>
|
|
22
|
-
(first matching case of x : when
|
|
23
|
-
first matching case of inner : when
|
|
22
|
+
(first matching case of x : when Absent then true when Present inner then
|
|
23
|
+
first matching case of inner : when Absent then true when Present payload then payload end case
|
|
24
24
|
end case) = true end for all
|
|
25
25
|
end definition
|
|
26
|
-
example "|outer absent| : x =
|
|
27
|
-
example "|inner absent| : x =
|
|
28
|
-
example "|present| : x =
|
|
26
|
+
example "|outer absent| : x = Absent expect x = Absent end example
|
|
27
|
+
example "|inner absent| : x = Present Absent expect x = Present Absent end example
|
|
28
|
+
example "|present| : x = Present (Present true) expect x = Present (Present true) end example
|
|
29
29
|
end law
|
|
30
30
|
|
|
31
31
|
law "|finite Either variants| is
|
|
@@ -38,13 +38,13 @@ end law
|
|
|
38
38
|
law "|dependent payload keeps outer binding| is
|
|
39
39
|
definition : for all (lawspecElement :: Int8)
|
|
40
40
|
(x :: Maybe (value :: Int8 where value > lawspecElement)) =>
|
|
41
|
-
(first matching case of x : when
|
|
41
|
+
(first matching case of x : when Absent then true when Present payload then payload - lawspecElement >= 1 end case) = true end for all
|
|
42
42
|
end definition
|
|
43
43
|
example "|maximum prefix has absent continuation| :
|
|
44
|
-
lawspecElement = 127 x =
|
|
44
|
+
lawspecElement = 127 x = Absent expect x = Absent
|
|
45
45
|
end example
|
|
46
46
|
example "|present continuation| :
|
|
47
|
-
lawspecElement = 0 x =
|
|
47
|
+
lawspecElement = 0 x = Present 1 expect x = Present 1
|
|
48
48
|
end example
|
|
49
49
|
end law
|
|
50
50
|
end unit
|
package/index.d.ts
CHANGED
|
@@ -430,13 +430,16 @@ export type DischargeStatus =
|
|
|
430
430
|
'known-failing' |
|
|
431
431
|
'flaky' |
|
|
432
432
|
'skipped' |
|
|
433
|
+
'pending' |
|
|
433
434
|
'proved' |
|
|
434
435
|
'exhaustively-checked' |
|
|
435
436
|
'property-tested' |
|
|
436
437
|
'measured' |
|
|
437
438
|
'runtime-checked' |
|
|
438
439
|
'default-handler' |
|
|
439
|
-
'assumed'
|
|
440
|
+
'assumed' |
|
|
441
|
+
'exempted' |
|
|
442
|
+
'refuted';
|
|
440
443
|
|
|
441
444
|
export interface ObligationEvidence {
|
|
442
445
|
owner: string;
|
|
@@ -445,6 +448,7 @@ export interface ObligationEvidence {
|
|
|
445
448
|
status: DischargeStatus;
|
|
446
449
|
reason: string;
|
|
447
450
|
claim: Expr | null;
|
|
451
|
+
exemption?: Exemption;
|
|
448
452
|
environment?: string;
|
|
449
453
|
environmentRun?: AttestedRun;
|
|
450
454
|
against?: AttestedDependency[];
|
|
@@ -537,8 +541,84 @@ export interface CheckRequest {
|
|
|
537
541
|
packages?: Package[];
|
|
538
542
|
cacheDirectory?: string;
|
|
539
543
|
attestation?: unknown;
|
|
544
|
+
proofCounterexamples?: ProofCounterexample[];
|
|
545
|
+
analysisResults?: AnalysisResult[];
|
|
546
|
+
projectVersion?: string;
|
|
547
|
+
now?: string;
|
|
548
|
+
modelResults?: ModelResult[];
|
|
540
549
|
}
|
|
541
550
|
|
|
551
|
+
export interface ModelResult {
|
|
552
|
+
fingerprint: string;
|
|
553
|
+
outcome: string;
|
|
554
|
+
values: string;
|
|
555
|
+
invariant: string;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
export interface ModelTaskRow {
|
|
559
|
+
owner: string;
|
|
560
|
+
declaration: string;
|
|
561
|
+
tasks: ModelTask[];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export interface ModelTask {
|
|
565
|
+
fingerprint: string;
|
|
566
|
+
kind: string;
|
|
567
|
+
script: string;
|
|
568
|
+
inputs: string[];
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export interface Exemption {
|
|
572
|
+
reason: string;
|
|
573
|
+
until: string | null;
|
|
574
|
+
expired: boolean;
|
|
575
|
+
law: string | null;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export interface AnalysisResult {
|
|
579
|
+
fingerprint: string;
|
|
580
|
+
outcome: string;
|
|
581
|
+
values: string;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export type AnalysisStage = 'completeness' | 'overlap' | 'conflict' | 'vacuity';
|
|
585
|
+
|
|
586
|
+
export type AnalysisTaskRow =
|
|
587
|
+
{
|
|
588
|
+
owner: string;
|
|
589
|
+
declaration: string;
|
|
590
|
+
stage: AnalysisStage;
|
|
591
|
+
status: 'ready';
|
|
592
|
+
tasks: AnalysisTask[];
|
|
593
|
+
} |
|
|
594
|
+
{
|
|
595
|
+
owner: string;
|
|
596
|
+
declaration: string;
|
|
597
|
+
stage: AnalysisStage;
|
|
598
|
+
status: 'unsupported';
|
|
599
|
+
reason: string;
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
export interface AnalysisTask {
|
|
603
|
+
fingerprint: string;
|
|
604
|
+
encoding: 'lawspec-smtlib-v2';
|
|
605
|
+
script: string;
|
|
606
|
+
inputs: string[];
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export interface AnalysisCheck {
|
|
610
|
+
owner: string;
|
|
611
|
+
declaration: string;
|
|
612
|
+
stage: AnalysisStage;
|
|
613
|
+
fingerprint: string;
|
|
614
|
+
status: AnalysisCheckStatus;
|
|
615
|
+
reason: string;
|
|
616
|
+
check: AnalysisCheckStatus;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
export type AnalysisCheckStatus =
|
|
620
|
+
'proved' | 'refuted' | 'exempted' | 'incomplete';
|
|
621
|
+
|
|
542
622
|
export interface GenerationRequest extends CheckRequest {
|
|
543
623
|
target: Target;
|
|
544
624
|
sourceDir?: string;
|
|
@@ -548,7 +628,7 @@ export interface GenerationRequest extends CheckRequest {
|
|
|
548
628
|
|
|
549
629
|
export type ProofTask =
|
|
550
630
|
{
|
|
551
|
-
encoding: 'lawspec-smtlib-v1';
|
|
631
|
+
encoding: 'lawspec-smtlib-v1' | 'lawspec-smtlib-v2';
|
|
552
632
|
owner: string;
|
|
553
633
|
declaration: string;
|
|
554
634
|
at: Location;
|
|
@@ -558,9 +638,14 @@ export type ProofTask =
|
|
|
558
638
|
script: string;
|
|
559
639
|
taskFingerprint: string;
|
|
560
640
|
trust: string;
|
|
641
|
+
counterexample?: CounterexampleQuery;
|
|
642
|
+
counterexampleUnsupported?: string;
|
|
643
|
+
recursion?: Recursion;
|
|
644
|
+
alternative?: AlternativeTask;
|
|
645
|
+
induction?: InductionPlan;
|
|
561
646
|
} |
|
|
562
647
|
{
|
|
563
|
-
encoding: 'lawspec-smtlib-v1';
|
|
648
|
+
encoding: 'lawspec-smtlib-v1' | 'lawspec-smtlib-v2';
|
|
564
649
|
owner: string;
|
|
565
650
|
declaration: string;
|
|
566
651
|
at: Location;
|
|
@@ -570,6 +655,66 @@ export type ProofTask =
|
|
|
570
655
|
reason: string;
|
|
571
656
|
};
|
|
572
657
|
|
|
658
|
+
export interface AlternativeTask {
|
|
659
|
+
recursion: Recursion;
|
|
660
|
+
script: string;
|
|
661
|
+
taskFingerprint: string;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export type InductionPlan =
|
|
665
|
+
{
|
|
666
|
+
on: string;
|
|
667
|
+
asked: boolean;
|
|
668
|
+
using: string[];
|
|
669
|
+
status: 'ready';
|
|
670
|
+
cases: InductionCase[];
|
|
671
|
+
} |
|
|
672
|
+
{
|
|
673
|
+
on: string;
|
|
674
|
+
asked: boolean;
|
|
675
|
+
using: string[];
|
|
676
|
+
status: 'unsupported';
|
|
677
|
+
reason: string;
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
export interface InductionCase {
|
|
681
|
+
case: string;
|
|
682
|
+
script: string;
|
|
683
|
+
recursion: Recursion;
|
|
684
|
+
taskFingerprint: string;
|
|
685
|
+
inputs: string[];
|
|
686
|
+
alternative?: AlternativeTask;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export type Recursion =
|
|
690
|
+
{encoding: 'guarded-axioms'; fuel: number;} | {encoding: 'define-fun-rec';};
|
|
691
|
+
|
|
692
|
+
export type ProofCounterexample =
|
|
693
|
+
{
|
|
694
|
+
owner: string;
|
|
695
|
+
declaration: string;
|
|
696
|
+
taskFingerprint: string;
|
|
697
|
+
values: string;
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
export type CounterexampleQuery =
|
|
701
|
+
{
|
|
702
|
+
encoding: 'lawspec-smtlib-v2';
|
|
703
|
+
script: string;
|
|
704
|
+
fingerprint: string;
|
|
705
|
+
inputs: {name: string; binder: string}[];
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
export type CounterexampleCheck =
|
|
709
|
+
{
|
|
710
|
+
owner?: string;
|
|
711
|
+
declaration?: string;
|
|
712
|
+
taskFingerprint?: string;
|
|
713
|
+
status: 'refuted' | 'model-not-confirmed' | 'incomplete';
|
|
714
|
+
reason: string;
|
|
715
|
+
inputs?: {name: string; value: string}[];
|
|
716
|
+
};
|
|
717
|
+
|
|
573
718
|
export type NativeSeed = number | string;
|
|
574
719
|
|
|
575
720
|
export type NativeFreshness =
|
|
@@ -729,6 +874,12 @@ export interface Result {
|
|
|
729
874
|
formattedSources?: Source[];
|
|
730
875
|
tests?: NativeTestEntry[];
|
|
731
876
|
proofTasks?: ProofTask[];
|
|
877
|
+
analysisTasks?: AnalysisTaskRow[];
|
|
878
|
+
analysisEvidence?: ObligationEvidence[];
|
|
879
|
+
analysisChecks?: AnalysisCheck[];
|
|
880
|
+
modelTasks?: ModelTaskRow[];
|
|
881
|
+
modelEvidence?: ObligationEvidence[];
|
|
882
|
+
counterexampleChecks?: CounterexampleCheck[];
|
|
732
883
|
evidence?: ObligationEvidence[];
|
|
733
884
|
attestation?: AttestationView;
|
|
734
885
|
packages?: PackageView[];
|
package/package.json
CHANGED
package/proof.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated from templates/npm/proof.d.ts by lawspec-dev generate. Do not edit.
|
|
2
|
-
import type {CheckRequest,Compiler,Location,Result} from './index.d.ts';
|
|
2
|
+
import type {CheckRequest,Compiler,Location,Recursion,Result} from './index.d.ts';
|
|
3
3
|
|
|
4
4
|
export interface Z3Options {
|
|
5
5
|
binary?: string;
|
|
@@ -9,19 +9,10 @@ export interface Z3Options {
|
|
|
9
9
|
seed?: number;
|
|
10
10
|
maxOutputBytes?: number;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
declaration: string;
|
|
15
|
-
at: Location;
|
|
16
|
-
encoding: 'lawspec-smtlib-v1';
|
|
17
|
-
machineBits: 32 | 64;
|
|
18
|
-
programFingerprint: string;
|
|
19
|
-
taskFingerprint?: string;
|
|
20
|
-
status: 'proved' | 'incomplete' | 'unsupported';
|
|
12
|
+
/** How a solver run went: shared by law and law-set evidence. */
|
|
13
|
+
interface SolverRun {
|
|
21
14
|
outcome: 'unsat' | 'sat' | 'unknown' | 'timeout' | 'resource-limit' | 'out-of-memory' | 'unavailable' | 'failed' | 'unsupported';
|
|
22
15
|
reason: string;
|
|
23
|
-
model?: string;
|
|
24
|
-
modelValidated?: false;
|
|
25
16
|
stdout?: string;
|
|
26
17
|
stderr?: string;
|
|
27
18
|
elapsedMs?: number;
|
|
@@ -31,5 +22,59 @@ export interface SolverEvidence {
|
|
|
31
22
|
prover?: {name:'z3'; version:string; binary:string; binaryFingerprint:string; fingerprint:string; arguments:string[]};
|
|
32
23
|
configuration?: Required<Z3Options>;
|
|
33
24
|
}
|
|
25
|
+
/** A law's proof task, run by Z3. */
|
|
26
|
+
export interface LawSolverEvidence extends SolverRun {
|
|
27
|
+
kind?: undefined;
|
|
28
|
+
owner: string;
|
|
29
|
+
declaration: string;
|
|
30
|
+
at: Location;
|
|
31
|
+
encoding: 'lawspec-smtlib-v1' | 'lawspec-smtlib-v2';
|
|
32
|
+
machineBits: 32 | 64;
|
|
33
|
+
programFingerprint: string;
|
|
34
|
+
taskFingerprint?: string;
|
|
35
|
+
status: 'proved' | 'refuted' | 'incomplete' | 'unsupported';
|
|
36
|
+
model?: string;
|
|
37
|
+
modelValidated?: boolean;
|
|
38
|
+
counterexample?: {inputs:{name:string;value:string}[]; values:string; fingerprint:string; runFingerprint:string;
|
|
39
|
+
check:'refuted'|'model-not-confirmed'|'incomplete'};
|
|
40
|
+
/** For a law over recursive definitions: the encoding of the run reported,
|
|
41
|
+
and each encoding tried, in order. */
|
|
42
|
+
recursion?: Recursion;
|
|
43
|
+
attempts?: {recursion:Recursion; taskFingerprint:string; outcome:SolverRun['outcome']; runFingerprint?:string; elapsedMs?:number}[];
|
|
44
|
+
/** Induction on an input: the cited laws, and each case's receipt. */
|
|
45
|
+
induction?: {on:string; using:string[]; asked?:boolean; cases:{case:string; outcome?:SolverRun['outcome']; recursion?:Recursion;
|
|
46
|
+
taskFingerprint?:string; runFingerprint?:string; values?:string; reason?:string;
|
|
47
|
+
attempts?:{recursion:Recursion; taskFingerprint:string; outcome:SolverRun['outcome']; runFingerprint?:string; elapsedMs?:number}[]}[]};
|
|
48
|
+
}
|
|
49
|
+
/** A law-set check's task (completeness, overlap, conflict or vacuity).
|
|
50
|
+
status is the task's own result; check is its row's. */
|
|
51
|
+
export interface AnalysisSolverEvidence extends SolverRun {
|
|
52
|
+
kind: 'analysis';
|
|
53
|
+
owner: string;
|
|
54
|
+
declaration: string;
|
|
55
|
+
stage: 'completeness' | 'overlap' | 'conflict' | 'vacuity';
|
|
56
|
+
encoding: 'lawspec-smtlib-v2';
|
|
57
|
+
taskFingerprint?: string;
|
|
58
|
+
status: 'proved' | 'refuted' | 'exempted' | 'incomplete' | 'unsupported';
|
|
59
|
+
check?: 'proved' | 'refuted' | 'exempted' | 'incomplete';
|
|
60
|
+
model?: undefined;
|
|
61
|
+
modelValidated?: undefined;
|
|
62
|
+
counterexample?: undefined;
|
|
63
|
+
}
|
|
64
|
+
/** A model law's task: induction, Spacer, an invariant re-check or the
|
|
65
|
+
bounded run search; the law's own row says what they settled. */
|
|
66
|
+
export interface ModelSolverEvidence extends SolverRun {
|
|
67
|
+
kind: 'model';
|
|
68
|
+
owner: string;
|
|
69
|
+
declaration: string;
|
|
70
|
+
task: string;
|
|
71
|
+
taskFingerprint: string;
|
|
72
|
+
encoding: 'lawspec-smtlib-v2';
|
|
73
|
+
status: 'proved' | 'incomplete';
|
|
74
|
+
model?: undefined;
|
|
75
|
+
modelValidated?: undefined;
|
|
76
|
+
counterexample?: undefined;
|
|
77
|
+
}
|
|
78
|
+
export type SolverEvidence = LawSolverEvidence | AnalysisSolverEvidence | ModelSolverEvidence;
|
|
34
79
|
export function proofTaskFingerprint(task: {encoding:string;programFingerprint:string;machineBits:number;owner:string;declaration:string;script:string}):string;
|
|
35
80
|
export function proveWithZ3(compiler:Compiler,request:CheckRequest,options?:Z3Options):Promise<Result & {solverEvidence:SolverEvidence[]}>;
|