logic-atlas 0.25.0 → 0.26.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 (81) hide show
  1. package/CITATION.cff +2 -2
  2. package/README.md +8 -4
  3. package/dist/case.js +1 -1
  4. package/dist/chunks/{CasePage-R2k_0lls.js → CasePage-CbCDu1FO.js} +3 -3
  5. package/dist/chunks/{CasePage-R2k_0lls.js.map → CasePage-CbCDu1FO.js.map} +1 -1
  6. package/dist/chunks/{CausalPlayground-Cd7Sok3F.js → CausalPlayground-D93D0ceE.js} +5 -5
  7. package/dist/chunks/{CausalPlayground-Cd7Sok3F.js.map → CausalPlayground-D93D0ceE.js.map} +1 -1
  8. package/dist/chunks/{CiteBlock-irdT1sjg.js → CiteBlock-DMFqM7ZM.js} +2 -2
  9. package/dist/chunks/{CiteBlock-irdT1sjg.js.map → CiteBlock-DMFqM7ZM.js.map} +1 -1
  10. package/dist/chunks/{ConservativeExtension-BX4EtG16.js → ConservativeExtension-Cofe92ak.js} +2 -2
  11. package/dist/chunks/{ConservativeExtension-BX4EtG16.js.map → ConservativeExtension-Cofe92ak.js.map} +1 -1
  12. package/dist/chunks/{ExportMenu-B5HoqaQl.js → ExportMenu-DaLZ5rBJ.js} +3 -3
  13. package/dist/chunks/{ExportMenu-B5HoqaQl.js.map → ExportMenu-DaLZ5rBJ.js.map} +1 -1
  14. package/dist/chunks/{GraphBox-Tg3kDWNT.js → GraphBox-DjjoWUU0.js} +3 -3
  15. package/dist/chunks/{GraphBox-Tg3kDWNT.js.map → GraphBox-DjjoWUU0.js.map} +1 -1
  16. package/dist/chunks/{IdentifyPanel-BVmZsWGN.js → IdentifyPanel-CoPC-Okk.js} +3 -3
  17. package/dist/chunks/{IdentifyPanel-BVmZsWGN.js.map → IdentifyPanel-CoPC-Okk.js.map} +1 -1
  18. package/dist/chunks/{ModelEditor-oAvvVqX5.js → ModelEditor-A6kk6Si5.js} +2 -2
  19. package/dist/chunks/{ModelEditor-oAvvVqX5.js.map → ModelEditor-A6kk6Si5.js.map} +1 -1
  20. package/dist/chunks/{ProbabilityPanel-8-cC68rq.js → ProbabilityPanel-DKTFYU-j.js} +5 -5
  21. package/dist/chunks/{ProbabilityPanel-8-cC68rq.js.map → ProbabilityPanel-DKTFYU-j.js.map} +1 -1
  22. package/dist/chunks/{RulesPanel-Cr6R9xCK.js → RulesPanel-B6X9O0he.js} +3 -3
  23. package/dist/chunks/{RulesPanel-Cr6R9xCK.js.map → RulesPanel-B6X9O0he.js.map} +1 -1
  24. package/dist/chunks/SignalGraph-CWPf_sG8.js +1412 -0
  25. package/dist/chunks/SignalGraph-CWPf_sG8.js.map +1 -0
  26. package/dist/chunks/{SliderList-BrILQCA4.js → SliderList-DmDURTeF.js} +2 -2
  27. package/dist/chunks/{SliderList-BrILQCA4.js.map → SliderList-DmDURTeF.js.map} +1 -1
  28. package/dist/chunks/{WorldLanes-kxYTRnB5.js → WorldLanes-DDtJZqcA.js} +2 -2
  29. package/dist/chunks/{WorldLanes-kxYTRnB5.js.map → WorldLanes-DDtJZqcA.js.map} +1 -1
  30. package/dist/chunks/{cite-B6emUIEW.js → cite-QzNc24r2.js} +2 -2
  31. package/dist/chunks/{cite-B6emUIEW.js.map → cite-QzNc24r2.js.map} +1 -1
  32. package/dist/chunks/{export-image-IsI6PVd9.js → export-image-BBHOXOis.js} +3 -3
  33. package/dist/chunks/{export-image-IsI6PVd9.js.map → export-image-BBHOXOis.js.map} +1 -1
  34. package/dist/cite.js +1 -1
  35. package/dist/editor.js +1 -1
  36. package/dist/extension.js +1 -1
  37. package/dist/ground-cases.js +767 -0
  38. package/dist/ground-cases.js.map +1 -0
  39. package/dist/ground.css +2 -0
  40. package/dist/ground.js +3829 -0
  41. package/dist/ground.js.map +1 -0
  42. package/dist/identify.js +1 -1
  43. package/dist/index.js +8 -8
  44. package/dist/lanes.js +1 -1
  45. package/dist/playground.js +1 -1
  46. package/dist/probability.js +1 -1
  47. package/dist/style.css +1 -1
  48. package/dist/types/ground/cases/index.d.ts +7 -0
  49. package/dist/types/ground/components/DiscernibilityPanel.d.ts +35 -0
  50. package/dist/types/ground/components/GroundChecker.d.ts +16 -0
  51. package/dist/types/ground/components/ProposalTable.d.ts +20 -0
  52. package/dist/types/ground/components/StructureView.d.ts +21 -0
  53. package/dist/types/ground/components/case-text.d.ts +32 -0
  54. package/dist/types/ground/components/parts.d.ts +59 -0
  55. package/dist/types/ground/components/structure-layout.d.ts +59 -0
  56. package/dist/types/ground/components/use-premises.d.ts +21 -0
  57. package/dist/types/ground/data/analyze.d.ts +41 -0
  58. package/dist/types/ground/data/case.d.ts +52 -0
  59. package/dist/types/ground/data/load.d.ts +30 -0
  60. package/dist/types/ground/data/presets.d.ts +32 -0
  61. package/dist/types/ground/data/schema.d.ts +303 -0
  62. package/dist/types/ground/engine/closure.d.ts +34 -0
  63. package/dist/types/ground/engine/discern.d.ts +84 -0
  64. package/dist/types/ground/engine/errors.d.ts +142 -0
  65. package/dist/types/ground/engine/evaluate.d.ts +25 -0
  66. package/dist/types/ground/engine/facts.d.ts +61 -0
  67. package/dist/types/ground/engine/formula.d.ts +100 -0
  68. package/dist/types/ground/engine/index.d.ts +26 -0
  69. package/dist/types/ground/engine/premises.d.ts +58 -0
  70. package/dist/types/ground/engine/print.d.ts +29 -0
  71. package/dist/types/ground/engine/proposals.d.ts +56 -0
  72. package/dist/types/ground/engine/resolve.d.ts +46 -0
  73. package/dist/types/ground/engine/syntax.d.ts +55 -0
  74. package/dist/types/ground/i18n/en.d.ts +2 -0
  75. package/dist/types/ground/i18n/messages.d.ts +14 -0
  76. package/dist/types/ground/i18n/zh.d.ts +95 -0
  77. package/dist/types/ground/index.d.ts +22 -0
  78. package/dist/types/logic/structure.d.ts +72 -0
  79. package/package.json +12 -3
  80. package/dist/chunks/SignalGraph-yoGcj7jf.js +0 -1405
  81. package/dist/chunks/SignalGraph-yoGcj7jf.js.map +0 -1
@@ -0,0 +1,52 @@
1
+ import type { FiniteStructure } from '../../logic/structure.js';
2
+ import type { Interpretation } from '../engine/evaluate.js';
3
+ import type { ClaimInstance } from '../engine/facts.js';
4
+ import type { PremiseSpace, Premises } from '../engine/premises.js';
5
+ import type { ProposalSpec } from '../engine/proposals.js';
6
+ import type { Vocabulary } from '../engine/resolve.js';
7
+ import type { RangeName } from '../engine/syntax.js';
8
+ import type { GroundCaseDoc, GroundText } from './schema.js';
9
+ /**
10
+ * A checked document made ready for the engine: its structure with defined extensions computed (and
11
+ * haecceities added when available), its vocabulary and definitions, the premises it can take, its
12
+ * proposals (built-in ones first) and its claims in one shape.
13
+ */
14
+ /** The most properties and relations a case may list. */
15
+ export declare const MAX_SYMBOLS = 24;
16
+ export interface ClaimSpec {
17
+ readonly id: string;
18
+ readonly grounded: string;
19
+ readonly full?: readonly string[];
20
+ readonly partial?: readonly string[];
21
+ readonly some?: Readonly<Record<string, RangeName>>;
22
+ /** The schema's first-order variables, ranging over the names. */
23
+ readonly vars: readonly string[];
24
+ readonly label?: GroundText;
25
+ /** For a claim written as a proposal's clause. */
26
+ readonly proposal?: {
27
+ readonly id: string;
28
+ readonly clause: 'identity' | 'distinctness';
29
+ };
30
+ }
31
+ export interface CaseProposal extends ProposalSpec {
32
+ readonly label?: GroundText;
33
+ readonly builtin: boolean;
34
+ }
35
+ export interface GroundCase {
36
+ readonly doc: GroundCaseDoc;
37
+ readonly structure: FiniteStructure;
38
+ readonly vocab: Vocabulary;
39
+ readonly space: PremiseSpace;
40
+ /** The built-in premises with the case's own defaults applied. */
41
+ readonly defaults: Premises;
42
+ readonly proposals: readonly CaseProposal[];
43
+ readonly claims: readonly ClaimSpec[];
44
+ /** Definition labels the case gives (`{R} is irreflexive`). */
45
+ readonly defLabels: Readonly<Record<string, GroundText>>;
46
+ }
47
+ /** Compile a checked document; throws a `GroundError` (with `where`) on what the schema cannot catch. */
48
+ export declare function compileCase(doc: GroundCaseDoc): GroundCase;
49
+ /** The claim resolved under `premises` and instantiated over every assignment of its variables to names. */
50
+ export declare function claimInstances(c: GroundCase, claim: ClaimSpec, premises: Premises, i: Interpretation): ClaimInstance[];
51
+ /** The case's premises with `settings` applied over its defaults. */
52
+ export declare function premisesFor(c: GroundCase, settings?: Readonly<Record<string, string>>): Premises;
@@ -0,0 +1,30 @@
1
+ import type { Locale } from '../../engine/types.js';
2
+ import type { GroundProblem } from '../engine/errors.js';
3
+ import type { Formula } from '../engine/formula.js';
4
+ import type { Premises } from '../engine/premises.js';
5
+ import type { GroundCase } from './case.js';
6
+ import type { GroundCaseDoc, GroundText } from './schema.js';
7
+ /** The longest JSON text `parseGroundJson` reads. */
8
+ export declare const MAX_GROUND_DOC_CHARS = 200000;
9
+ export type GroundImportResult = {
10
+ readonly ok: true;
11
+ readonly doc: GroundCaseDoc;
12
+ readonly compiled: GroundCase;
13
+ } | {
14
+ readonly ok: false;
15
+ readonly errors: readonly GroundProblem[];
16
+ };
17
+ /** A closed formula of the case, resolved under `premises`; throws `free-variable` when it is not closed. */
18
+ export declare function closedFormula(c: GroundCase, source: string, premises?: Premises): Formula;
19
+ /** Everything the schema cannot say: the case compiles, every formula resolves, every premise and preset is known. */
20
+ export declare function checkGroundDoc(doc: GroundCaseDoc): {
21
+ readonly problems: GroundProblem[];
22
+ readonly compiled?: GroundCase;
23
+ };
24
+ /**
25
+ * Read a case from JSON text or an already parsed value. Never throws: what is wrong comes back as
26
+ * `errors`, each a {@link GroundProblem} with the path where it sits.
27
+ */
28
+ export declare function parseGroundJson(input: string | unknown): GroundImportResult;
29
+ /** Document text in `locale`. */
30
+ export declare function groundText(text: GroundText | undefined, locale: Locale): string | undefined;
@@ -0,0 +1,32 @@
1
+ import type { Premises } from '../engine/premises.js';
2
+ import type { GroundAnalysis, PairAnalysis } from './analyze.js';
3
+ import type { GroundCase } from './case.js';
4
+ import type { GroundPreset, PairExpect } from './schema.js';
5
+ /**
6
+ * Presets: one press sets premises and a query, and `expect` says what the engine should find. The
7
+ * package's tests run `checkPresets` on every bundled case; a host runs it at build time too.
8
+ */
9
+ export interface PresetMismatch {
10
+ readonly preset: string;
11
+ readonly key: string;
12
+ readonly expected: unknown;
13
+ readonly actual: unknown;
14
+ }
15
+ export declare function presetPremises(c: GroundCase, preset: GroundPreset): Premises;
16
+ /** The pair query's results, keyed as `expect` writes them. */
17
+ export declare function pairActual(a: PairAnalysis): Required<PairExpect>;
18
+ /** What the preset's query gives: the pair analysis or the derivation. */
19
+ export declare function runPreset(c: GroundCase, preset: GroundPreset): {
20
+ readonly kind: 'pair';
21
+ readonly result: PairAnalysis;
22
+ } | {
23
+ readonly kind: 'ground';
24
+ readonly result: GroundAnalysis;
25
+ };
26
+ /** The preset's expectations that the engine does not meet (empty: all met). */
27
+ export declare function checkPreset(c: GroundCase, preset: GroundPreset): PresetMismatch[];
28
+ /**
29
+ * Run every preset of a case and return the expectations not met. Takes a compiled case, a document
30
+ * value or its JSON text; a document that does not check throws a `GroundError` with its first problem.
31
+ */
32
+ export declare function checkPresets(doc: GroundCase | unknown): PresetMismatch[];
@@ -0,0 +1,303 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Ground case documents (`kind: "ground-case"`), as hosts and the bundled cases write them in JSON:
4
+ * a finite structure, definitions, proposals, grounding claims and targets, premise defaults and
5
+ * presets. Formulas are strings in the authoring syntax (`parseRaw`). The schema checks the shape;
6
+ * `checkGroundDoc` checks what the shape cannot say (known ids, formulas that resolve, premises).
7
+ */
8
+ /** Text in both languages, or one string for both. */
9
+ export declare const groundTextSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
10
+ 'zh-TW': z.ZodString;
11
+ en: z.ZodString;
12
+ }, z.core.$strict>]>;
13
+ export declare const structureSchema: z.ZodObject<{
14
+ individuals: z.ZodArray<z.ZodObject<{
15
+ id: z.ZodString;
16
+ symbol: z.ZodOptional<z.ZodString>;
17
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
18
+ 'zh-TW': z.ZodString;
19
+ en: z.ZodString;
20
+ }, z.core.$strict>]>>;
21
+ }, z.core.$strict>>;
22
+ names: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
23
+ properties: z.ZodDefault<z.ZodArray<z.ZodObject<{
24
+ id: z.ZodString;
25
+ symbol: z.ZodOptional<z.ZodString>;
26
+ qualitative: z.ZodBoolean;
27
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
28
+ 'zh-TW': z.ZodString;
29
+ en: z.ZodString;
30
+ }, z.core.$strict>]>>;
31
+ holds: z.ZodOptional<z.ZodArray<z.ZodString>>;
32
+ define: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$strict>>>;
34
+ relations: z.ZodDefault<z.ZodArray<z.ZodObject<{
35
+ id: z.ZodString;
36
+ symbol: z.ZodOptional<z.ZodString>;
37
+ qualitative: z.ZodBoolean;
38
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
39
+ 'zh-TW': z.ZodString;
40
+ en: z.ZodString;
41
+ }, z.core.$strict>]>>;
42
+ pairs: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
43
+ define: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strict>>>;
45
+ haecceities: z.ZodDefault<z.ZodEnum<{
46
+ available: "available";
47
+ none: "none";
48
+ }>>;
49
+ }, z.core.$strict>;
50
+ declare const pairExpectSchema: z.ZodObject<{
51
+ shared: z.ZodOptional<z.ZodBoolean>;
52
+ propertyDiscernible: z.ZodOptional<z.ZodBoolean>;
53
+ absolute: z.ZodOptional<z.ZodBoolean>;
54
+ relative: z.ZodOptional<z.ZodBoolean>;
55
+ weak: z.ZodOptional<z.ZodBoolean>;
56
+ irreflexiveWitness: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ allReflexive: z.ZodOptional<z.ZodBoolean>;
58
+ proposals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
59
+ explained: "explained";
60
+ "necessitation-conflict": "necessitation-conflict";
61
+ "no-ground": "no-ground";
62
+ "same-ground": "same-ground";
63
+ trivial: "trivial";
64
+ }>>>;
65
+ clauses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
66
+ identity: z.ZodOptional<z.ZodBoolean>;
67
+ distinctness: z.ZodOptional<z.ZodBoolean>;
68
+ }, z.core.$strict>>>;
69
+ }, z.core.$strict>;
70
+ declare const groundExpectSchema: z.ZodObject<{
71
+ selfGround: z.ZodOptional<z.ZodBoolean>;
72
+ selfGroundFact: z.ZodOptional<z.ZodString>;
73
+ chainRules: z.ZodOptional<z.ZodArray<z.ZodString>>;
74
+ partial: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
+ notPartial: z.ZodOptional<z.ZodArray<z.ZodString>>;
76
+ fullGrounds: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
77
+ claimFails: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
+ }, z.core.$strict>;
79
+ export declare const presetSchema: z.ZodObject<{
80
+ id: z.ZodString;
81
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
82
+ 'zh-TW': z.ZodString;
83
+ en: z.ZodString;
84
+ }, z.core.$strict>]>;
85
+ premises: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
86
+ query: z.ZodDiscriminatedUnion<[z.ZodObject<{
87
+ kind: z.ZodLiteral<"pair">;
88
+ pair: z.ZodTuple<[z.ZodString, z.ZodString], null>;
89
+ }, z.core.$strict>, z.ZodObject<{
90
+ kind: z.ZodLiteral<"cycle">;
91
+ target: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ kind: z.ZodLiteral<"grounds">;
94
+ target: z.ZodString;
95
+ }, z.core.$strict>], "kind">;
96
+ test: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
97
+ 'zh-TW': z.ZodString;
98
+ en: z.ZodString;
99
+ }, z.core.$strict>]>>;
100
+ expect: z.ZodUnion<readonly [z.ZodObject<{
101
+ shared: z.ZodOptional<z.ZodBoolean>;
102
+ propertyDiscernible: z.ZodOptional<z.ZodBoolean>;
103
+ absolute: z.ZodOptional<z.ZodBoolean>;
104
+ relative: z.ZodOptional<z.ZodBoolean>;
105
+ weak: z.ZodOptional<z.ZodBoolean>;
106
+ irreflexiveWitness: z.ZodOptional<z.ZodNullable<z.ZodString>>;
107
+ allReflexive: z.ZodOptional<z.ZodBoolean>;
108
+ proposals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
109
+ explained: "explained";
110
+ "necessitation-conflict": "necessitation-conflict";
111
+ "no-ground": "no-ground";
112
+ "same-ground": "same-ground";
113
+ trivial: "trivial";
114
+ }>>>;
115
+ clauses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
116
+ identity: z.ZodOptional<z.ZodBoolean>;
117
+ distinctness: z.ZodOptional<z.ZodBoolean>;
118
+ }, z.core.$strict>>>;
119
+ }, z.core.$strict>, z.ZodObject<{
120
+ selfGround: z.ZodOptional<z.ZodBoolean>;
121
+ selfGroundFact: z.ZodOptional<z.ZodString>;
122
+ chainRules: z.ZodOptional<z.ZodArray<z.ZodString>>;
123
+ partial: z.ZodOptional<z.ZodArray<z.ZodString>>;
124
+ notPartial: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
+ fullGrounds: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
126
+ claimFails: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
+ }, z.core.$strict>]>;
128
+ }, z.core.$strict>;
129
+ export declare const groundCaseSchema: z.ZodObject<{
130
+ kind: z.ZodLiteral<"ground-case">;
131
+ id: z.ZodString;
132
+ title: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
133
+ 'zh-TW': z.ZodString;
134
+ en: z.ZodString;
135
+ }, z.core.$strict>]>;
136
+ sources: z.ZodDefault<z.ZodArray<z.ZodObject<{
137
+ cite: z.ZodString;
138
+ pages: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$strict>>>;
140
+ structure: z.ZodObject<{
141
+ individuals: z.ZodArray<z.ZodObject<{
142
+ id: z.ZodString;
143
+ symbol: z.ZodOptional<z.ZodString>;
144
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
145
+ 'zh-TW': z.ZodString;
146
+ en: z.ZodString;
147
+ }, z.core.$strict>]>>;
148
+ }, z.core.$strict>>;
149
+ names: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
150
+ properties: z.ZodDefault<z.ZodArray<z.ZodObject<{
151
+ id: z.ZodString;
152
+ symbol: z.ZodOptional<z.ZodString>;
153
+ qualitative: z.ZodBoolean;
154
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
155
+ 'zh-TW': z.ZodString;
156
+ en: z.ZodString;
157
+ }, z.core.$strict>]>>;
158
+ holds: z.ZodOptional<z.ZodArray<z.ZodString>>;
159
+ define: z.ZodOptional<z.ZodString>;
160
+ }, z.core.$strict>>>;
161
+ relations: z.ZodDefault<z.ZodArray<z.ZodObject<{
162
+ id: z.ZodString;
163
+ symbol: z.ZodOptional<z.ZodString>;
164
+ qualitative: z.ZodBoolean;
165
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
166
+ 'zh-TW': z.ZodString;
167
+ en: z.ZodString;
168
+ }, z.core.$strict>]>>;
169
+ pairs: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
170
+ define: z.ZodOptional<z.ZodString>;
171
+ }, z.core.$strict>>>;
172
+ haecceities: z.ZodDefault<z.ZodEnum<{
173
+ available: "available";
174
+ none: "none";
175
+ }>>;
176
+ }, z.core.$strict>;
177
+ defs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
178
+ variants: z.ZodRecord<z.ZodString, z.ZodString>;
179
+ default: z.ZodString;
180
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
181
+ 'zh-TW': z.ZodString;
182
+ en: z.ZodString;
183
+ }, z.core.$strict>]>>;
184
+ }, z.core.$strict>]>>>;
185
+ proposals: z.ZodDefault<z.ZodArray<z.ZodObject<{
186
+ id: z.ZodString;
187
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
188
+ 'zh-TW': z.ZodString;
189
+ en: z.ZodString;
190
+ }, z.core.$strict>]>;
191
+ identity: z.ZodObject<{
192
+ full: z.ZodArray<z.ZodString>;
193
+ some: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
194
+ Prop: "Prop";
195
+ Qual: "Qual";
196
+ Rel: "Rel";
197
+ }>>>;
198
+ }, z.core.$strict>;
199
+ distinctness: z.ZodObject<{
200
+ full: z.ZodArray<z.ZodString>;
201
+ some: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
202
+ Prop: "Prop";
203
+ Qual: "Qual";
204
+ Rel: "Rel";
205
+ }>>>;
206
+ }, z.core.$strict>;
207
+ }, z.core.$strict>>>;
208
+ ground: z.ZodDefault<z.ZodObject<{
209
+ claims: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
210
+ id: z.ZodString;
211
+ proposal: z.ZodString;
212
+ clause: z.ZodEnum<{
213
+ distinctness: "distinctness";
214
+ identity: "identity";
215
+ }>;
216
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
217
+ 'zh-TW': z.ZodString;
218
+ en: z.ZodString;
219
+ }, z.core.$strict>]>>;
220
+ }, z.core.$strict>, z.ZodObject<{
221
+ id: z.ZodString;
222
+ grounded: z.ZodString;
223
+ full: z.ZodOptional<z.ZodArray<z.ZodString>>;
224
+ partial: z.ZodOptional<z.ZodArray<z.ZodString>>;
225
+ some: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
226
+ Prop: "Prop";
227
+ Qual: "Qual";
228
+ Rel: "Rel";
229
+ }>>>;
230
+ label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
231
+ 'zh-TW': z.ZodString;
232
+ en: z.ZodString;
233
+ }, z.core.$strict>]>>;
234
+ }, z.core.$strict>]>>>;
235
+ targets: z.ZodDefault<z.ZodArray<z.ZodString>>;
236
+ }, z.core.$strict>>;
237
+ premises: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
238
+ switches: z.ZodOptional<z.ZodArray<z.ZodString>>;
239
+ presets: z.ZodDefault<z.ZodArray<z.ZodObject<{
240
+ id: z.ZodString;
241
+ label: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
242
+ 'zh-TW': z.ZodString;
243
+ en: z.ZodString;
244
+ }, z.core.$strict>]>;
245
+ premises: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
246
+ query: z.ZodDiscriminatedUnion<[z.ZodObject<{
247
+ kind: z.ZodLiteral<"pair">;
248
+ pair: z.ZodTuple<[z.ZodString, z.ZodString], null>;
249
+ }, z.core.$strict>, z.ZodObject<{
250
+ kind: z.ZodLiteral<"cycle">;
251
+ target: z.ZodOptional<z.ZodString>;
252
+ }, z.core.$strict>, z.ZodObject<{
253
+ kind: z.ZodLiteral<"grounds">;
254
+ target: z.ZodString;
255
+ }, z.core.$strict>], "kind">;
256
+ test: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
257
+ 'zh-TW': z.ZodString;
258
+ en: z.ZodString;
259
+ }, z.core.$strict>]>>;
260
+ expect: z.ZodUnion<readonly [z.ZodObject<{
261
+ shared: z.ZodOptional<z.ZodBoolean>;
262
+ propertyDiscernible: z.ZodOptional<z.ZodBoolean>;
263
+ absolute: z.ZodOptional<z.ZodBoolean>;
264
+ relative: z.ZodOptional<z.ZodBoolean>;
265
+ weak: z.ZodOptional<z.ZodBoolean>;
266
+ irreflexiveWitness: z.ZodOptional<z.ZodNullable<z.ZodString>>;
267
+ allReflexive: z.ZodOptional<z.ZodBoolean>;
268
+ proposals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
269
+ explained: "explained";
270
+ "necessitation-conflict": "necessitation-conflict";
271
+ "no-ground": "no-ground";
272
+ "same-ground": "same-ground";
273
+ trivial: "trivial";
274
+ }>>>;
275
+ clauses: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
276
+ identity: z.ZodOptional<z.ZodBoolean>;
277
+ distinctness: z.ZodOptional<z.ZodBoolean>;
278
+ }, z.core.$strict>>>;
279
+ }, z.core.$strict>, z.ZodObject<{
280
+ selfGround: z.ZodOptional<z.ZodBoolean>;
281
+ selfGroundFact: z.ZodOptional<z.ZodString>;
282
+ chainRules: z.ZodOptional<z.ZodArray<z.ZodString>>;
283
+ partial: z.ZodOptional<z.ZodArray<z.ZodString>>;
284
+ notPartial: z.ZodOptional<z.ZodArray<z.ZodString>>;
285
+ fullGrounds: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
286
+ claimFails: z.ZodOptional<z.ZodArray<z.ZodString>>;
287
+ }, z.core.$strict>]>;
288
+ }, z.core.$strict>>>;
289
+ }, z.core.$strict>;
290
+ export type GroundText = z.infer<typeof groundTextSchema>;
291
+ /** A checked case document. */
292
+ export type GroundCaseDoc = z.infer<typeof groundCaseSchema>;
293
+ /** A case document as written, before defaults are filled in. */
294
+ export type GroundCaseInput = z.input<typeof groundCaseSchema>;
295
+ export type GroundPreset = z.infer<typeof presetSchema>;
296
+ export type GroundPresetInput = z.input<typeof presetSchema>;
297
+ export type GroundQuery = GroundPreset['query'];
298
+ export type PairExpect = z.infer<typeof pairExpectSchema>;
299
+ export type GroundExpect = z.infer<typeof groundExpectSchema>;
300
+ export type ClaimDoc = GroundCaseDoc['ground']['claims'][number];
301
+ /** The expect keys a pair query answers. */
302
+ export declare const PAIR_EXPECT_KEYS: readonly string[];
303
+ export {};
@@ -0,0 +1,34 @@
1
+ import type { GroundGraph, RuleId } from './facts.js';
2
+ /**
3
+ * Partial ground over a derivation: A ≺ B when A is in one of B's direct grounds, closed under
4
+ * transitivity when that premise is on. A fact grounds itself when it lies on a cycle (transitive) or
5
+ * is one of its own direct grounds (not transitive). The chain is the shortest cycle through the
6
+ * fact, written one line per step with the rule behind it.
7
+ */
8
+ /** Direct partial-ground edges: for each fact, the facts it directly partially grounds. */
9
+ export declare function successors(g: GroundGraph): number[][];
10
+ /** Strongly connected components (Tarjan), each as its facts in increasing order. */
11
+ export declare function components(succ: readonly (readonly number[])[]): number[][];
12
+ /** The facts that partially ground themselves, in fact order. */
13
+ export declare function selfGrounding(g: GroundGraph, transitive: boolean): number[];
14
+ /** The shortest cycle from `start` back to itself (breadth first, earlier facts first), as its facts with `start` at both ends. */
15
+ export declare function shortestCycle(g: GroundGraph, start: number, transitive: boolean): number[] | undefined;
16
+ /** The partial grounds of `fact`: its direct grounds' members, or (transitive) every fact with a path to it. */
17
+ export declare function partialGrounds(g: GroundGraph, fact: number, transitive: boolean): number[];
18
+ /** One line of a chain: `from` ≺ `to` by `rule`; `steps` > 1 when consecutive instance steps of a quantifier rule are merged. */
19
+ export interface ChainRow {
20
+ readonly from: number;
21
+ readonly to: number;
22
+ readonly rule: RuleId | 'transitivity';
23
+ readonly steps: number;
24
+ /** The facts passed through when steps are merged, in order. */
25
+ readonly through: readonly number[];
26
+ }
27
+ /**
28
+ * The cycle written as rows: an `equivalents` step first shows the step into the equivalent fact
29
+ * (A ≺ ¬B ∨ A by disjunction, then A ≺ B → A), consecutive steps of one quantifier rule merge into one
30
+ * row, and a cycle of more than one step ends with `start` ≺ `start` by transitivity.
31
+ */
32
+ export declare function chainRows(g: GroundGraph, cycle: readonly number[]): ChainRow[];
33
+ /** The rules a chain uses, in order, without the closing transitivity row. */
34
+ export declare function chainRules(rows: readonly ChainRow[]): (RuleId | 'transitivity')[];
@@ -0,0 +1,84 @@
1
+ import type { RelationCheck } from '../../logic/relations.js';
2
+ import type { Automorphism, FiniteStructure } from '../../logic/structure.js';
3
+ /**
4
+ * Discernibility of one pair of names on a finite structure: which properties they share, whether
5
+ * a qualitative property, a qualitative formula (absolute), an asymmetric relation (relative) or a
6
+ * relation one of them lacks to itself (weak) tells them apart, and which relations between them are
7
+ * irreflexive or reflexive on the whole domain.
8
+ */
9
+ export interface PropertyRow {
10
+ readonly id: string;
11
+ readonly qualitative: boolean;
12
+ readonly haecceity: boolean;
13
+ readonly a: boolean;
14
+ readonly b: boolean;
15
+ }
16
+ export interface RelationRow {
17
+ readonly id: string;
18
+ readonly qualitative: boolean;
19
+ /** Wörner's four facts: Rab, Rba, ¬Raa, ¬Rbb. */
20
+ readonly ab: boolean;
21
+ readonly ba: boolean;
22
+ readonly notAa: boolean;
23
+ readonly notBb: boolean;
24
+ readonly irreflexive: RelationCheck;
25
+ readonly reflexive: RelationCheck;
26
+ }
27
+ /**
28
+ * Why two individuals are absolutely discernible: a qualitative property one has; a relational
29
+ * profile (∃y Rxy, ∃y Ryx, ∃y(Rxy ∧ Fy), ∃y(Ryx ∧ Fy)) one has; or only the whole structure, with the
30
+ * number of colour-refinement rounds that separate them.
31
+ */
32
+ export type AbsoluteWitness = {
33
+ readonly kind: 'property';
34
+ readonly property: string;
35
+ readonly of: 'a' | 'b';
36
+ } | {
37
+ readonly kind: 'profile';
38
+ readonly relation: string;
39
+ readonly direction: 'out' | 'in';
40
+ readonly property?: string;
41
+ readonly of: 'a' | 'b';
42
+ } | {
43
+ readonly kind: 'structure';
44
+ readonly depth: number;
45
+ };
46
+ export interface Discernment {
47
+ readonly a: string;
48
+ readonly b: string;
49
+ /** The two names refer to one individual. */
50
+ readonly same: boolean;
51
+ readonly properties: readonly PropertyRow[];
52
+ /** Every qualitative property is had by both or neither. */
53
+ readonly sharesQualitative: boolean;
54
+ /** A qualitative property that one has and the other lacks. */
55
+ readonly propertyDiscernible: {
56
+ readonly holds: boolean;
57
+ readonly witness?: string;
58
+ };
59
+ readonly absolute: {
60
+ readonly holds: boolean;
61
+ readonly witness?: AbsoluteWitness;
62
+ };
63
+ /** A qualitative relation with Rab ∧ ¬Rba. */
64
+ readonly relative: {
65
+ readonly holds: boolean;
66
+ readonly witness?: string;
67
+ };
68
+ /** A qualitative relation with Rab ∧ ¬Raa, or Rab ∧ ¬Rbb. */
69
+ readonly weak: {
70
+ readonly holds: boolean;
71
+ readonly witness?: string;
72
+ };
73
+ readonly relations: readonly RelationRow[];
74
+ /** A relation with Rab that is irreflexive on the whole domain (Shumener's weak-discernibility ground). */
75
+ readonly irreflexiveWitness?: string;
76
+ /** Every relation holding from a to b is reflexive (the weak proposal's identity clause). */
77
+ readonly allReflexive: boolean;
78
+ }
79
+ /**
80
+ * Discernibility of the names `a` and `b` on `s`. Absolute discernibility is decided by the
81
+ * automorphisms of the qualitative structure (at most 8 individuals); pass them in when checking many
82
+ * pairs of one structure.
83
+ */
84
+ export declare function discern(s: FiniteStructure, a: string, b: string, auts?: readonly Automorphism[]): Discernment;