@proposit/proposit-core 0.8.9
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/README.md +1032 -0
- package/dist/cli/commands/analysis.d.ts +3 -0
- package/dist/cli/commands/analysis.d.ts.map +1 -0
- package/dist/cli/commands/analysis.js +504 -0
- package/dist/cli/commands/analysis.js.map +1 -0
- package/dist/cli/commands/arguments.d.ts +3 -0
- package/dist/cli/commands/arguments.d.ts.map +1 -0
- package/dist/cli/commands/arguments.js +187 -0
- package/dist/cli/commands/arguments.js.map +1 -0
- package/dist/cli/commands/claims.d.ts +3 -0
- package/dist/cli/commands/claims.d.ts.map +1 -0
- package/dist/cli/commands/claims.js +120 -0
- package/dist/cli/commands/claims.js.map +1 -0
- package/dist/cli/commands/diff.d.ts +3 -0
- package/dist/cli/commands/diff.d.ts.map +1 -0
- package/dist/cli/commands/diff.js +61 -0
- package/dist/cli/commands/diff.js.map +1 -0
- package/dist/cli/commands/expressions.d.ts +3 -0
- package/dist/cli/commands/expressions.d.ts.map +1 -0
- package/dist/cli/commands/expressions.js +344 -0
- package/dist/cli/commands/expressions.js.map +1 -0
- package/dist/cli/commands/graph.d.ts +13 -0
- package/dist/cli/commands/graph.d.ts.map +1 -0
- package/dist/cli/commands/graph.js +382 -0
- package/dist/cli/commands/graph.js.map +1 -0
- package/dist/cli/commands/meta.d.ts +3 -0
- package/dist/cli/commands/meta.d.ts.map +1 -0
- package/dist/cli/commands/meta.js +14 -0
- package/dist/cli/commands/meta.js.map +1 -0
- package/dist/cli/commands/parse.d.ts +3 -0
- package/dist/cli/commands/parse.d.ts.map +1 -0
- package/dist/cli/commands/parse.js +171 -0
- package/dist/cli/commands/parse.js.map +1 -0
- package/dist/cli/commands/premises.d.ts +3 -0
- package/dist/cli/commands/premises.d.ts.map +1 -0
- package/dist/cli/commands/premises.js +261 -0
- package/dist/cli/commands/premises.js.map +1 -0
- package/dist/cli/commands/render.d.ts +3 -0
- package/dist/cli/commands/render.d.ts.map +1 -0
- package/dist/cli/commands/render.js +109 -0
- package/dist/cli/commands/render.js.map +1 -0
- package/dist/cli/commands/repair.d.ts +3 -0
- package/dist/cli/commands/repair.d.ts.map +1 -0
- package/dist/cli/commands/repair.js +53 -0
- package/dist/cli/commands/repair.js.map +1 -0
- package/dist/cli/commands/roles.d.ts +3 -0
- package/dist/cli/commands/roles.d.ts.map +1 -0
- package/dist/cli/commands/roles.js +64 -0
- package/dist/cli/commands/roles.js.map +1 -0
- package/dist/cli/commands/sources.d.ts +3 -0
- package/dist/cli/commands/sources.d.ts.map +1 -0
- package/dist/cli/commands/sources.js +103 -0
- package/dist/cli/commands/sources.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +3 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +27 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/commands/variables.d.ts +3 -0
- package/dist/cli/commands/variables.d.ts.map +1 -0
- package/dist/cli/commands/variables.js +206 -0
- package/dist/cli/commands/variables.js.map +1 -0
- package/dist/cli/commands/version-show.d.ts +3 -0
- package/dist/cli/commands/version-show.d.ts.map +1 -0
- package/dist/cli/commands/version-show.js +31 -0
- package/dist/cli/commands/version-show.js.map +1 -0
- package/dist/cli/config.d.ts +8 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +24 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/engine.d.ts +19 -0
- package/dist/cli/engine.d.ts.map +1 -0
- package/dist/cli/engine.js +173 -0
- package/dist/cli/engine.js.map +1 -0
- package/dist/cli/import.d.ts +22 -0
- package/dist/cli/import.d.ts.map +1 -0
- package/dist/cli/import.js +242 -0
- package/dist/cli/import.js.map +1 -0
- package/dist/cli/llm/index.d.ts +6 -0
- package/dist/cli/llm/index.d.ts.map +1 -0
- package/dist/cli/llm/index.js +26 -0
- package/dist/cli/llm/index.js.map +1 -0
- package/dist/cli/llm/openai.d.ts +4 -0
- package/dist/cli/llm/openai.d.ts.map +1 -0
- package/dist/cli/llm/openai.js +44 -0
- package/dist/cli/llm/openai.js.map +1 -0
- package/dist/cli/llm/types.d.ts +14 -0
- package/dist/cli/llm/types.d.ts.map +1 -0
- package/dist/cli/llm/types.js +2 -0
- package/dist/cli/llm/types.js.map +1 -0
- package/dist/cli/logging.d.ts +8 -0
- package/dist/cli/logging.d.ts.map +1 -0
- package/dist/cli/logging.js +23 -0
- package/dist/cli/logging.js.map +1 -0
- package/dist/cli/output/diff-renderer.d.ts +4 -0
- package/dist/cli/output/diff-renderer.d.ts.map +1 -0
- package/dist/cli/output/diff-renderer.js +89 -0
- package/dist/cli/output/diff-renderer.js.map +1 -0
- package/dist/cli/output.d.ts +6 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +41 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/router.d.ts +14 -0
- package/dist/cli/router.d.ts.map +1 -0
- package/dist/cli/router.js +59 -0
- package/dist/cli/router.js.map +1 -0
- package/dist/cli/schemata.d.ts +74 -0
- package/dist/cli/schemata.d.ts.map +1 -0
- package/dist/cli/schemata.js +89 -0
- package/dist/cli/schemata.js.map +1 -0
- package/dist/cli/storage/analysis.d.ts +9 -0
- package/dist/cli/storage/analysis.d.ts.map +1 -0
- package/dist/cli/storage/analysis.js +108 -0
- package/dist/cli/storage/analysis.js.map +1 -0
- package/dist/cli/storage/arguments.d.ts +12 -0
- package/dist/cli/storage/arguments.d.ts.map +1 -0
- package/dist/cli/storage/arguments.js +80 -0
- package/dist/cli/storage/arguments.js.map +1 -0
- package/dist/cli/storage/libraries.d.ts +14 -0
- package/dist/cli/storage/libraries.d.ts.map +1 -0
- package/dist/cli/storage/libraries.js +80 -0
- package/dist/cli/storage/libraries.js.map +1 -0
- package/dist/cli/storage/premises.d.ts +9 -0
- package/dist/cli/storage/premises.d.ts.map +1 -0
- package/dist/cli/storage/premises.js +67 -0
- package/dist/cli/storage/premises.js.map +1 -0
- package/dist/cli/storage/roles.d.ts +4 -0
- package/dist/cli/storage/roles.d.ts.map +1 -0
- package/dist/cli/storage/roles.js +26 -0
- package/dist/cli/storage/roles.js.map +1 -0
- package/dist/cli/storage/variables.d.ts +4 -0
- package/dist/cli/storage/variables.d.ts.map +1 -0
- package/dist/cli/storage/variables.js +36 -0
- package/dist/cli/storage/variables.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +65 -0
- package/dist/cli.js.map +1 -0
- package/dist/extensions/basics/argument-parser.d.ts +12 -0
- package/dist/extensions/basics/argument-parser.d.ts.map +1 -0
- package/dist/extensions/basics/argument-parser.js +27 -0
- package/dist/extensions/basics/argument-parser.js.map +1 -0
- package/dist/extensions/basics/index.d.ts +4 -0
- package/dist/extensions/basics/index.d.ts.map +1 -0
- package/dist/extensions/basics/index.js +3 -0
- package/dist/extensions/basics/index.js.map +1 -0
- package/dist/extensions/basics/schemata.d.ts +35 -0
- package/dist/extensions/basics/schemata.d.ts.map +1 -0
- package/dist/extensions/basics/schemata.js +55 -0
- package/dist/extensions/basics/schemata.js.map +1 -0
- package/dist/extensions/ieee/formatting.d.ts +18 -0
- package/dist/extensions/ieee/formatting.d.ts.map +1 -0
- package/dist/extensions/ieee/formatting.js +57 -0
- package/dist/extensions/ieee/formatting.js.map +1 -0
- package/dist/extensions/ieee/index.d.ts +6 -0
- package/dist/extensions/ieee/index.d.ts.map +1 -0
- package/dist/extensions/ieee/index.js +6 -0
- package/dist/extensions/ieee/index.js.map +1 -0
- package/dist/extensions/ieee/references.d.ts +1379 -0
- package/dist/extensions/ieee/references.d.ts.map +1 -0
- package/dist/extensions/ieee/references.js +929 -0
- package/dist/extensions/ieee/references.js.map +1 -0
- package/dist/extensions/ieee/relaxed.d.ts +1371 -0
- package/dist/extensions/ieee/relaxed.d.ts.map +1 -0
- package/dist/extensions/ieee/relaxed.js +160 -0
- package/dist/extensions/ieee/relaxed.js.map +1 -0
- package/dist/extensions/ieee/segment-builder.d.ts +9 -0
- package/dist/extensions/ieee/segment-builder.d.ts.map +1 -0
- package/dist/extensions/ieee/segment-builder.js +98 -0
- package/dist/extensions/ieee/segment-builder.js.map +1 -0
- package/dist/extensions/ieee/segment-templates.d.ts +58 -0
- package/dist/extensions/ieee/segment-templates.d.ts.map +1 -0
- package/dist/extensions/ieee/segment-templates.js +1618 -0
- package/dist/extensions/ieee/segment-templates.js.map +1 -0
- package/dist/extensions/ieee/source.d.ts +434 -0
- package/dist/extensions/ieee/source.d.ts.map +1 -0
- package/dist/extensions/ieee/source.js +12 -0
- package/dist/extensions/ieee/source.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/consts.d.ts +21 -0
- package/dist/lib/consts.d.ts.map +1 -0
- package/dist/lib/consts.js +117 -0
- package/dist/lib/consts.js.map +1 -0
- package/dist/lib/core/argument-engine.d.ts +181 -0
- package/dist/lib/core/argument-engine.d.ts.map +1 -0
- package/dist/lib/core/argument-engine.js +1294 -0
- package/dist/lib/core/argument-engine.js.map +1 -0
- package/dist/lib/core/argument-library.d.ts +84 -0
- package/dist/lib/core/argument-library.d.ts.map +1 -0
- package/dist/lib/core/argument-library.js +122 -0
- package/dist/lib/core/argument-library.js.map +1 -0
- package/dist/lib/core/argument-validation.d.ts +74 -0
- package/dist/lib/core/argument-validation.d.ts.map +1 -0
- package/dist/lib/core/argument-validation.js +315 -0
- package/dist/lib/core/argument-validation.js.map +1 -0
- package/dist/lib/core/change-collector.d.ts +24 -0
- package/dist/lib/core/change-collector.d.ts.map +1 -0
- package/dist/lib/core/change-collector.js +63 -0
- package/dist/lib/core/change-collector.js.map +1 -0
- package/dist/lib/core/checksum.d.ts +15 -0
- package/dist/lib/core/checksum.d.ts.map +1 -0
- package/dist/lib/core/checksum.js +43 -0
- package/dist/lib/core/checksum.js.map +1 -0
- package/dist/lib/core/claim-library.d.ts +23 -0
- package/dist/lib/core/claim-library.d.ts.map +1 -0
- package/dist/lib/core/claim-library.js +21 -0
- package/dist/lib/core/claim-library.js.map +1 -0
- package/dist/lib/core/claim-source-library.d.ts +32 -0
- package/dist/lib/core/claim-source-library.d.ts.map +1 -0
- package/dist/lib/core/claim-source-library.js +193 -0
- package/dist/lib/core/claim-source-library.js.map +1 -0
- package/dist/lib/core/diff.d.ts +20 -0
- package/dist/lib/core/diff.d.ts.map +1 -0
- package/dist/lib/core/diff.js +260 -0
- package/dist/lib/core/diff.js.map +1 -0
- package/dist/lib/core/evaluation/argument-evaluation.d.ts +53 -0
- package/dist/lib/core/evaluation/argument-evaluation.d.ts.map +1 -0
- package/dist/lib/core/evaluation/argument-evaluation.js +535 -0
- package/dist/lib/core/evaluation/argument-evaluation.js.map +1 -0
- package/dist/lib/core/evaluation/grading.d.ts +28 -0
- package/dist/lib/core/evaluation/grading.d.ts.map +1 -0
- package/dist/lib/core/evaluation/grading.js +44 -0
- package/dist/lib/core/evaluation/grading.js.map +1 -0
- package/dist/lib/core/evaluation/kleene.d.ts +12 -0
- package/dist/lib/core/evaluation/kleene.d.ts.map +1 -0
- package/dist/lib/core/evaluation/kleene.js +29 -0
- package/dist/lib/core/evaluation/kleene.js.map +1 -0
- package/dist/lib/core/evaluation/validation.d.ts +10 -0
- package/dist/lib/core/evaluation/validation.d.ts.map +1 -0
- package/dist/lib/core/evaluation/validation.js +28 -0
- package/dist/lib/core/evaluation/validation.js.map +1 -0
- package/dist/lib/core/expression-manager.d.ts +278 -0
- package/dist/lib/core/expression-manager.d.ts.map +1 -0
- package/dist/lib/core/expression-manager.js +1622 -0
- package/dist/lib/core/expression-manager.js.map +1 -0
- package/dist/lib/core/fork-library.d.ts +26 -0
- package/dist/lib/core/fork-library.d.ts.map +1 -0
- package/dist/lib/core/fork-library.js +71 -0
- package/dist/lib/core/fork-library.js.map +1 -0
- package/dist/lib/core/fork-namespace.d.ts +32 -0
- package/dist/lib/core/fork-namespace.d.ts.map +1 -0
- package/dist/lib/core/fork-namespace.js +99 -0
- package/dist/lib/core/fork-namespace.js.map +1 -0
- package/dist/lib/core/fork.d.ts +30 -0
- package/dist/lib/core/fork.d.ts.map +1 -0
- package/dist/lib/core/fork.js +125 -0
- package/dist/lib/core/fork.js.map +1 -0
- package/dist/lib/core/interfaces/argument-engine.interfaces.d.ts +366 -0
- package/dist/lib/core/interfaces/argument-engine.interfaces.d.ts.map +1 -0
- package/dist/lib/core/interfaces/argument-engine.interfaces.js +2 -0
- package/dist/lib/core/interfaces/argument-engine.interfaces.js.map +1 -0
- package/dist/lib/core/interfaces/index.d.ts +5 -0
- package/dist/lib/core/interfaces/index.d.ts.map +1 -0
- package/dist/lib/core/interfaces/index.js +2 -0
- package/dist/lib/core/interfaces/index.js.map +1 -0
- package/dist/lib/core/interfaces/library.interfaces.d.ts +347 -0
- package/dist/lib/core/interfaces/library.interfaces.d.ts.map +1 -0
- package/dist/lib/core/interfaces/library.interfaces.js +2 -0
- package/dist/lib/core/interfaces/library.interfaces.js.map +1 -0
- package/dist/lib/core/interfaces/premise-engine.interfaces.d.ts +401 -0
- package/dist/lib/core/interfaces/premise-engine.interfaces.d.ts.map +1 -0
- package/dist/lib/core/interfaces/premise-engine.interfaces.js +2 -0
- package/dist/lib/core/interfaces/premise-engine.interfaces.js.map +1 -0
- package/dist/lib/core/interfaces/shared.interfaces.d.ts +28 -0
- package/dist/lib/core/interfaces/shared.interfaces.d.ts.map +1 -0
- package/dist/lib/core/interfaces/shared.interfaces.js +2 -0
- package/dist/lib/core/interfaces/shared.interfaces.js.map +1 -0
- package/dist/lib/core/invariant-violation-error.d.ts +10 -0
- package/dist/lib/core/invariant-violation-error.d.ts.map +1 -0
- package/dist/lib/core/invariant-violation-error.js +16 -0
- package/dist/lib/core/invariant-violation-error.js.map +1 -0
- package/dist/lib/core/parser/formula-gen.js +923 -0
- package/dist/lib/core/parser/formula.d.ts +24 -0
- package/dist/lib/core/parser/formula.d.ts.map +1 -0
- package/dist/lib/core/parser/formula.js +8 -0
- package/dist/lib/core/parser/formula.js.map +1 -0
- package/dist/lib/core/premise-engine.d.ts +122 -0
- package/dist/lib/core/premise-engine.d.ts.map +1 -0
- package/dist/lib/core/premise-engine.js +1362 -0
- package/dist/lib/core/premise-engine.js.map +1 -0
- package/dist/lib/core/proposit-core.d.ts +111 -0
- package/dist/lib/core/proposit-core.d.ts.map +1 -0
- package/dist/lib/core/proposit-core.js +365 -0
- package/dist/lib/core/proposit-core.js.map +1 -0
- package/dist/lib/core/relationships.d.ts +15 -0
- package/dist/lib/core/relationships.d.ts.map +1 -0
- package/dist/lib/core/relationships.js +319 -0
- package/dist/lib/core/relationships.js.map +1 -0
- package/dist/lib/core/source-library.d.ts +23 -0
- package/dist/lib/core/source-library.d.ts.map +1 -0
- package/dist/lib/core/source-library.js +21 -0
- package/dist/lib/core/source-library.js.map +1 -0
- package/dist/lib/core/variable-manager.d.ts +68 -0
- package/dist/lib/core/variable-manager.d.ts.map +1 -0
- package/dist/lib/core/variable-manager.js +200 -0
- package/dist/lib/core/variable-manager.js.map +1 -0
- package/dist/lib/core/versioned-library.d.ts +52 -0
- package/dist/lib/core/versioned-library.d.ts.map +1 -0
- package/dist/lib/core/versioned-library.js +192 -0
- package/dist/lib/core/versioned-library.js.map +1 -0
- package/dist/lib/index.d.ts +54 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +39 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/parsing/argument-parser.d.ts +49 -0
- package/dist/lib/parsing/argument-parser.d.ts.map +1 -0
- package/dist/lib/parsing/argument-parser.js +403 -0
- package/dist/lib/parsing/argument-parser.js.map +1 -0
- package/dist/lib/parsing/clamp-max-lengths.d.ts +11 -0
- package/dist/lib/parsing/clamp-max-lengths.d.ts.map +1 -0
- package/dist/lib/parsing/clamp-max-lengths.js +56 -0
- package/dist/lib/parsing/clamp-max-lengths.js.map +1 -0
- package/dist/lib/parsing/index.d.ts +7 -0
- package/dist/lib/parsing/index.d.ts.map +1 -0
- package/dist/lib/parsing/index.js +4 -0
- package/dist/lib/parsing/index.js.map +1 -0
- package/dist/lib/parsing/prompt-builder.d.ts +11 -0
- package/dist/lib/parsing/prompt-builder.d.ts.map +1 -0
- package/dist/lib/parsing/prompt-builder.js +229 -0
- package/dist/lib/parsing/prompt-builder.js.map +1 -0
- package/dist/lib/parsing/schemata.d.ts +79 -0
- package/dist/lib/parsing/schemata.d.ts.map +1 -0
- package/dist/lib/parsing/schemata.js +92 -0
- package/dist/lib/parsing/schemata.js.map +1 -0
- package/dist/lib/parsing/types.d.ts +24 -0
- package/dist/lib/parsing/types.d.ts.map +1 -0
- package/dist/lib/parsing/types.js +2 -0
- package/dist/lib/parsing/types.js.map +1 -0
- package/dist/lib/schemata/analysis.d.ts +9 -0
- package/dist/lib/schemata/analysis.d.ts.map +1 -0
- package/dist/lib/schemata/analysis.js +13 -0
- package/dist/lib/schemata/analysis.js.map +1 -0
- package/dist/lib/schemata/argument.d.ts +14 -0
- package/dist/lib/schemata/argument.d.ts.map +1 -0
- package/dist/lib/schemata/argument.js +24 -0
- package/dist/lib/schemata/argument.js.map +1 -0
- package/dist/lib/schemata/claim.d.ts +9 -0
- package/dist/lib/schemata/claim.d.ts.map +1 -0
- package/dist/lib/schemata/claim.js +18 -0
- package/dist/lib/schemata/claim.js.map +1 -0
- package/dist/lib/schemata/fork.d.ts +76 -0
- package/dist/lib/schemata/fork.d.ts.map +1 -0
- package/dist/lib/schemata/fork.js +55 -0
- package/dist/lib/schemata/fork.js.map +1 -0
- package/dist/lib/schemata/import.d.ts +33 -0
- package/dist/lib/schemata/import.d.ts.map +1 -0
- package/dist/lib/schemata/import.js +18 -0
- package/dist/lib/schemata/import.js.map +1 -0
- package/dist/lib/schemata/index.d.ts +8 -0
- package/dist/lib/schemata/index.d.ts.map +1 -0
- package/dist/lib/schemata/index.js +8 -0
- package/dist/lib/schemata/index.js.map +1 -0
- package/dist/lib/schemata/propositional.d.ts +142 -0
- package/dist/lib/schemata/propositional.d.ts.map +1 -0
- package/dist/lib/schemata/propositional.js +120 -0
- package/dist/lib/schemata/propositional.js.map +1 -0
- package/dist/lib/schemata/shared.d.ts +41 -0
- package/dist/lib/schemata/shared.d.ts.map +1 -0
- package/dist/lib/schemata/shared.js +66 -0
- package/dist/lib/schemata/shared.js.map +1 -0
- package/dist/lib/schemata/source.d.ts +18 -0
- package/dist/lib/schemata/source.d.ts.map +1 -0
- package/dist/lib/schemata/source.js +35 -0
- package/dist/lib/schemata/source.js.map +1 -0
- package/dist/lib/types/checksum.d.ts +20 -0
- package/dist/lib/types/checksum.d.ts.map +1 -0
- package/dist/lib/types/checksum.js +2 -0
- package/dist/lib/types/checksum.js.map +1 -0
- package/dist/lib/types/diff.d.ts +60 -0
- package/dist/lib/types/diff.d.ts.map +1 -0
- package/dist/lib/types/diff.js +2 -0
- package/dist/lib/types/diff.js.map +1 -0
- package/dist/lib/types/evaluation.d.ts +164 -0
- package/dist/lib/types/evaluation.d.ts.map +1 -0
- package/dist/lib/types/evaluation.js +2 -0
- package/dist/lib/types/evaluation.js.map +1 -0
- package/dist/lib/types/fork.d.ts +25 -0
- package/dist/lib/types/fork.d.ts.map +1 -0
- package/dist/lib/types/fork.js +2 -0
- package/dist/lib/types/fork.js.map +1 -0
- package/dist/lib/types/grammar.d.ts +38 -0
- package/dist/lib/types/grammar.d.ts.map +1 -0
- package/dist/lib/types/grammar.js +11 -0
- package/dist/lib/types/grammar.js.map +1 -0
- package/dist/lib/types/mutation.d.ts +31 -0
- package/dist/lib/types/mutation.d.ts.map +1 -0
- package/dist/lib/types/mutation.js +2 -0
- package/dist/lib/types/mutation.js.map +1 -0
- package/dist/lib/types/reactive.d.ts +14 -0
- package/dist/lib/types/reactive.d.ts.map +1 -0
- package/dist/lib/types/reactive.js +2 -0
- package/dist/lib/types/reactive.js.map +1 -0
- package/dist/lib/types/relationships.d.ts +36 -0
- package/dist/lib/types/relationships.d.ts.map +1 -0
- package/dist/lib/types/relationships.js +2 -0
- package/dist/lib/types/relationships.js.map +1 -0
- package/dist/lib/types/validation.d.ts +47 -0
- package/dist/lib/types/validation.d.ts.map +1 -0
- package/dist/lib/types/validation.js +43 -0
- package/dist/lib/types/validation.js.map +1 -0
- package/dist/lib/utils/changeset.d.ts +124 -0
- package/dist/lib/utils/changeset.d.ts.map +1 -0
- package/dist/lib/utils/changeset.js +221 -0
- package/dist/lib/utils/changeset.js.map +1 -0
- package/dist/lib/utils/collections.d.ts +12 -0
- package/dist/lib/utils/collections.d.ts.map +1 -0
- package/dist/lib/utils/collections.js +24 -0
- package/dist/lib/utils/collections.js.map +1 -0
- package/dist/lib/utils/default-map.d.ts +17 -0
- package/dist/lib/utils/default-map.d.ts.map +1 -0
- package/dist/lib/utils/default-map.js +33 -0
- package/dist/lib/utils/default-map.js.map +1 -0
- package/dist/lib/utils/lookup.d.ts +47 -0
- package/dist/lib/utils/lookup.d.ts.map +1 -0
- package/dist/lib/utils/lookup.js +62 -0
- package/dist/lib/utils/lookup.js.map +1 -0
- package/dist/lib/utils/position.d.ts +12 -0
- package/dist/lib/utils/position.d.ts.map +1 -0
- package/dist/lib/utils/position.js +13 -0
- package/dist/lib/utils/position.js.map +1 -0
- package/package.json +82 -0
- package/skills/proposit-core/SKILL.md +35 -0
- package/skills/proposit-core/docs/api-usage.md +442 -0
- package/skills/proposit-core/docs/architecture.md +256 -0
- package/skills/proposit-core/docs/cli.md +304 -0
- package/skills/proposit-core/docs/testing.md +281 -0
- package/skills/proposit-core/docs/types-schemas.md +648 -0
package/README.md
ADDED
|
@@ -0,0 +1,1032 @@
|
|
|
1
|
+
# proposit-core
|
|
2
|
+
|
|
3
|
+
Core engine for building, evaluating, and checking the logical validity of propositional-logic arguments. Manages typed trees of variables and expressions across one or more **premises**, with strict structural invariants, automatic operator collapse, a display renderer, and a truth-table validity checker.
|
|
4
|
+
|
|
5
|
+
Also ships a **CLI** (`proposit-core`) for managing arguments, premises, variables, expressions, and analyses stored on disk.
|
|
6
|
+
|
|
7
|
+
Full documentation is available at <https://www.polintpro.com/proposit-core/>.
|
|
8
|
+
|
|
9
|
+
## Visual Overview
|
|
10
|
+
|
|
11
|
+
```mermaid
|
|
12
|
+
flowchart TD
|
|
13
|
+
AE["ArgumentEngine"]
|
|
14
|
+
|
|
15
|
+
AE --> PM["PremiseEngine (0..N)"]
|
|
16
|
+
AE --> VM["Variables (0..N, shared)"]
|
|
17
|
+
AE --> Roles["Roles"]
|
|
18
|
+
|
|
19
|
+
PM --> EM["ExpressionManager"]
|
|
20
|
+
EM --> ET["Expression Tree"]
|
|
21
|
+
|
|
22
|
+
VM --> CBV["Claim-Bound\n(claimId, claimVersion)"]
|
|
23
|
+
VM --> PBV["Premise-Bound\n(boundPremiseId,\nboundArgumentId,\nboundArgumentVersion)"]
|
|
24
|
+
|
|
25
|
+
CBV -.-> CL
|
|
26
|
+
PBV -.->|"references specific premise\n(may be cross-argument)"| PM
|
|
27
|
+
|
|
28
|
+
Roles -.->|"conclusionPremiseId\n(supporting & constraint\nroles are derived)"| PM
|
|
29
|
+
|
|
30
|
+
subgraph Injected["Injected Libraries"]
|
|
31
|
+
CL["ClaimLibrary"]
|
|
32
|
+
SL["SourceLibrary"]
|
|
33
|
+
CSL["ClaimSourceLibrary"]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
AE -.-> Injected
|
|
37
|
+
|
|
38
|
+
style Injected fill:none,stroke:#888,stroke-dasharray: 5 5
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pnpm add @polintpro/proposit-core
|
|
45
|
+
# or
|
|
46
|
+
npm install @polintpro/proposit-core
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Concepts
|
|
50
|
+
|
|
51
|
+
### Argument
|
|
52
|
+
|
|
53
|
+
An `ArgumentEngine` is scoped to a single **argument** — a record with an `id`, `version`, `title`, and `description`. Every variable and expression carries a matching `argumentId` and `argumentVersion`; the engine rejects entities that belong to a different argument. Expressions also carry a `premiseId` identifying which premise they belong to, and premises carry `argumentId` and `argumentVersion` for self-describing references.
|
|
54
|
+
|
|
55
|
+
### Premises
|
|
56
|
+
|
|
57
|
+
An argument is composed of one or more **premises**, each managed by a `PremiseEngine`. Premises come in two types derived from their root expression:
|
|
58
|
+
|
|
59
|
+
- **Inference premise** (`"inference"`) — root is `implies` or `iff`. Used as a supporting premise or the conclusion of the argument.
|
|
60
|
+
- **Constraint premise** (`"constraint"`) — root is anything else. Restricts which variable assignments are considered admissible without contributing to the inference chain.
|
|
61
|
+
|
|
62
|
+
### Variables
|
|
63
|
+
|
|
64
|
+
A **propositional variable** (e.g. `P`, `Q`, `Rain`) is a named atomic proposition. Variables are registered with the `ArgumentEngine` via `addVariable()` and are shared across all premises. Each variable must have a unique `id` and a unique `symbol` within the argument.
|
|
65
|
+
|
|
66
|
+
### Expressions
|
|
67
|
+
|
|
68
|
+
An **expression** is a node in the rooted expression tree managed by a `PremiseEngine`. There are three kinds:
|
|
69
|
+
|
|
70
|
+
- **Variable expression** (`"variable"`) — a leaf node that references a registered variable.
|
|
71
|
+
- **Operator expression** (`"operator"`) — an interior node that applies a logical operator to its children.
|
|
72
|
+
- **Formula expression** (`"formula"`) — a transparent unary wrapper, equivalent to parentheses around its single child.
|
|
73
|
+
|
|
74
|
+
The five supported operators and their arities are:
|
|
75
|
+
|
|
76
|
+
| Operator | Symbol | Arity |
|
|
77
|
+
| --------- | ------ | -------------- |
|
|
78
|
+
| `not` | ¬ | unary (= 1) |
|
|
79
|
+
| `and` | ∧ | variadic (≥ 2) |
|
|
80
|
+
| `or` | ∨ | variadic (≥ 2) |
|
|
81
|
+
| `implies` | → | binary (= 2) |
|
|
82
|
+
| `iff` | ↔ | binary (= 2) |
|
|
83
|
+
|
|
84
|
+
`implies` and `iff` are **root-only**: they must have `parentId: null` and cannot be nested inside another expression.
|
|
85
|
+
|
|
86
|
+
The following diagram shows how the expression `¬(P ∧ R) → (Q ∨ S)` is represented as a tree. Note the formula node — a transparent wrapper equivalent to parentheses — and that `implies` must be the root:
|
|
87
|
+
|
|
88
|
+
```mermaid
|
|
89
|
+
flowchart TD
|
|
90
|
+
IMP["→ implies\n(root-only, binary)"]
|
|
91
|
+
|
|
92
|
+
IMP --> NOT["¬ not\n(unary)"]
|
|
93
|
+
IMP --> OR["∨ or\n(variadic, ≥ 2)"]
|
|
94
|
+
|
|
95
|
+
NOT --> FRM["( ) formula\n(transparent wrapper,\nexactly 1 child)"]
|
|
96
|
+
|
|
97
|
+
FRM --> AND["∧ and\n(variadic, ≥ 2)"]
|
|
98
|
+
|
|
99
|
+
AND --> P["P\n(variable)"]
|
|
100
|
+
AND --> R["R\n(variable)"]
|
|
101
|
+
|
|
102
|
+
OR --> Q["Q\n(variable)"]
|
|
103
|
+
OR --> S["S\n(variable)"]
|
|
104
|
+
|
|
105
|
+
style IMP fill:#e8f4fd,stroke:#2196f3
|
|
106
|
+
style NOT fill:#e8f4fd,stroke:#2196f3
|
|
107
|
+
style AND fill:#e8f4fd,stroke:#2196f3
|
|
108
|
+
style OR fill:#e8f4fd,stroke:#2196f3
|
|
109
|
+
style FRM fill:none,stroke:#888,stroke-dasharray: 5 5
|
|
110
|
+
style P fill:#f5f5f5,stroke:#666
|
|
111
|
+
style R fill:#f5f5f5,stroke:#666
|
|
112
|
+
style Q fill:#f5f5f5,stroke:#666
|
|
113
|
+
style S fill:#f5f5f5,stroke:#666
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Argument roles
|
|
117
|
+
|
|
118
|
+
To evaluate or check an argument, premises must be assigned roles:
|
|
119
|
+
|
|
120
|
+
- **Conclusion** — the single premise whose truth is being argued for. Set with `ArgumentEngine.setConclusionPremise()`. The first premise added to an engine is automatically designated as the conclusion if none is set; explicit `setConclusionPremise()` overrides this.
|
|
121
|
+
- **Supporting** — any inference premise (root is `implies` or `iff`) that is not the conclusion is automatically considered supporting. There is no explicit method to add or remove supporting premises.
|
|
122
|
+
|
|
123
|
+
A premise that is neither supporting nor the conclusion and whose type is `"constraint"` is automatically used to filter admissible variable assignments during validity checking.
|
|
124
|
+
|
|
125
|
+
The following diagram shows how premises, roles, and shared variables compose an argument:
|
|
126
|
+
|
|
127
|
+
```mermaid
|
|
128
|
+
flowchart TD
|
|
129
|
+
ARG["Argument"]
|
|
130
|
+
|
|
131
|
+
ARG --> P1["Premise 1\n<b>Conclusion</b>\n(inference: root is →)"]
|
|
132
|
+
ARG --> P2["Premise 2\n<b>Supporting</b>\n(inference: root is ↔)"]
|
|
133
|
+
ARG --> P3["Premise 3\n<b>Constraint</b>\n(root is ∧)"]
|
|
134
|
+
|
|
135
|
+
subgraph Shared["Shared Variables"]
|
|
136
|
+
VP["P"]
|
|
137
|
+
VQ["Q"]
|
|
138
|
+
VR["R"]
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
P1 -.- VP
|
|
142
|
+
P1 -.- VQ
|
|
143
|
+
P2 -.- VQ
|
|
144
|
+
P2 -.- VR
|
|
145
|
+
P3 -.- VP
|
|
146
|
+
P3 -.- VR
|
|
147
|
+
|
|
148
|
+
note1["Conclusion: set via setConclusionPremise()\nFirst premise auto-designated if not set"]
|
|
149
|
+
note2["Supporting: any inference premise\nthat is not the conclusion (derived)"]
|
|
150
|
+
note3["Constraint: any non-inference premise (derived)"]
|
|
151
|
+
|
|
152
|
+
P1 ~~~ note1
|
|
153
|
+
P2 ~~~ note2
|
|
154
|
+
P3 ~~~ note3
|
|
155
|
+
|
|
156
|
+
style P1 fill:#e8f4fd,stroke:#2196f3
|
|
157
|
+
style P2 fill:#e8f4fd,stroke:#2196f3
|
|
158
|
+
style P3 fill:#fff3e0,stroke:#ff9800
|
|
159
|
+
style Shared fill:none,stroke:#888,stroke-dasharray: 5 5
|
|
160
|
+
style note1 fill:none,stroke:none
|
|
161
|
+
style note2 fill:none,stroke:none
|
|
162
|
+
style note3 fill:none,stroke:none
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### PropositCore
|
|
166
|
+
|
|
167
|
+
`PropositCore` is the recommended top-level entry point. It creates and wires together all five libraries and provides unified cross-library operations:
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
import { PropositCore } from "@polintpro/proposit-core"
|
|
171
|
+
|
|
172
|
+
const core = new PropositCore()
|
|
173
|
+
|
|
174
|
+
// Create a claim in the global claim library
|
|
175
|
+
const claim = core.claims.create({ id: "claim-1", text: "All men are mortal" })
|
|
176
|
+
|
|
177
|
+
// Create an argument engine — libraries are wired automatically
|
|
178
|
+
const engine = core.arguments.create({
|
|
179
|
+
id: "arg-1",
|
|
180
|
+
version: 0,
|
|
181
|
+
title: "Socrates is mortal",
|
|
182
|
+
description: "",
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
// Fork the argument — clones claims/sources, records provenance
|
|
186
|
+
const { engine: forked, remapTable } = core.forkArgument("arg-1", "arg-2")
|
|
187
|
+
|
|
188
|
+
// Diff with automatic fork-aware entity matching
|
|
189
|
+
const diff = core.diffArguments("arg-1", "arg-2")
|
|
190
|
+
|
|
191
|
+
// Snapshot the entire system state
|
|
192
|
+
const snapshot = core.snapshot()
|
|
193
|
+
const restored = PropositCore.fromSnapshot(snapshot)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
`PropositCore` is designed for subclassing. All library fields (`claims`, `sources`, `claimSources`, `forks`, `arguments`) are public and readable. Pass pre-constructed library instances via `TPropositCoreOptions` to inject custom implementations.
|
|
197
|
+
|
|
198
|
+
### No application metadata
|
|
199
|
+
|
|
200
|
+
The core library does not deal in user IDs, timestamps, or display text. These are application-level concerns. The CLI adds some metadata (e.g., `createdAt`, `publishedAt`) for its own purposes, but the core schemas are intentionally minimal. Applications extend core entity types via generic parameters.
|
|
201
|
+
|
|
202
|
+
### Sources
|
|
203
|
+
|
|
204
|
+
A **source** is an evidentiary reference (paper, article, URL). Source entities live in a global `SourceLibrary` with versioning and freeze semantics (same as `ClaimLibrary`).
|
|
205
|
+
|
|
206
|
+
Claim-source associations are managed by `ClaimSourceLibrary<TAssoc>` — a standalone global class that links a claim version to a source version. Associations are immutable: create or delete only, no update. `ClaimSourceLibrary` validates both the claim and source references on `add()`.
|
|
207
|
+
|
|
208
|
+
The `@polintpro/proposit-core/extensions/ieee` subpath export provides `IEEESourceSchema` — an extended source type with IEEE citation reference schemas covering 33 reference types.
|
|
209
|
+
|
|
210
|
+
### Auto-variable creation
|
|
211
|
+
|
|
212
|
+
When a premise is created via `createPremise()` or `createPremiseWithId()`, the engine automatically creates a **premise-bound variable** for it. This variable allows other premises in the same argument to reference the premise's truth value in their expression trees without manual variable setup.
|
|
213
|
+
|
|
214
|
+
The auto-created variable gets a symbol from an optional `symbol` parameter, or an auto-generated one (`"P0"`, `"P1"`, ...) with collision avoidance. The variable is included in the returned changeset.
|
|
215
|
+
|
|
216
|
+
### Argument forking
|
|
217
|
+
|
|
218
|
+
An argument can be **forked** via `PropositCore.forkArgument()` to create an independent copy — useful for responding to, critiquing, or expanding on another author's argument. Forking:
|
|
219
|
+
|
|
220
|
+
- Creates a new argument with a new ID (version 0)
|
|
221
|
+
- Assigns new UUIDs to all premises, expressions, and variables
|
|
222
|
+
- Clones all referenced claims and sources (including their claim-source associations)
|
|
223
|
+
- Creates fork records in all six `ForkLibrary` namespaces (arguments, premises, expressions, variables, claims, sources)
|
|
224
|
+
- Remaps all internal references (expression parent chains, variable bindings, conclusion role, claim references)
|
|
225
|
+
- Registers the new engine in `ArgumentLibrary`
|
|
226
|
+
- Returns the new engine, a remap table, claim/source remap maps, and the argument fork record
|
|
227
|
+
|
|
228
|
+
The forked argument is fully independent — mutations don't affect the source. Fork-aware diffing is automatic via `PropositCore.diffArguments()`, which uses `ForkLibrary` records as entity matchers rather than ID-based pairing.
|
|
229
|
+
|
|
230
|
+
Subclasses can override the public `canFork()` method to restrict which arguments may be forked (e.g., only published versions). For low-level forking without orchestration, use the standalone `forkArgumentEngine()` function.
|
|
231
|
+
|
|
232
|
+
### Cross-argument variable binding
|
|
233
|
+
|
|
234
|
+
A variable can reference a premise in a **different** argument via `bindVariableToExternalPremise()`. This enables structured inter-argument reasoning — for example, Rich's response to John's argument can reference John's premises as variables.
|
|
235
|
+
|
|
236
|
+
External bindings are **evaluator-assigned**: during evaluation they behave like claim-bound variables (the evaluator provides truth values in the assignment). The binding is navigational — it tells readers where the proposition is defined, but the engine doesn't resolve across argument boundaries. External bindings are included as free variables in truth-table generation.
|
|
237
|
+
|
|
238
|
+
`bindVariableToArgument()` is a convenience for binding to another argument's conclusion premise — the caller provides the conclusion premise ID and the method delegates to `bindVariableToExternalPremise()`.
|
|
239
|
+
|
|
240
|
+
Subclasses can override the protected `canBind()` method to restrict which external arguments may be referenced (e.g., only published versions).
|
|
241
|
+
|
|
242
|
+
Each expression carries:
|
|
243
|
+
|
|
244
|
+
| Field | Type | Description |
|
|
245
|
+
| ----------------- | ---------------- | ---------------------------------------------------------- |
|
|
246
|
+
| `id` | `string` | Unique identifier. |
|
|
247
|
+
| `argumentId` | `string` | Must match the engine's argument. |
|
|
248
|
+
| `argumentVersion` | `number` | Must match the engine's argument version. |
|
|
249
|
+
| `premiseId` | `string` | ID of the premise this expression belongs to. |
|
|
250
|
+
| `parentId` | `string \| null` | ID of the parent operator, or `null` for root nodes. |
|
|
251
|
+
| `position` | `number` | Numeric position among siblings (midpoint-based ordering). |
|
|
252
|
+
|
|
253
|
+
## Usage
|
|
254
|
+
|
|
255
|
+
### Creating an engine and premises
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
import { ArgumentEngine, POSITION_INITIAL } from "@polintpro/proposit-core"
|
|
259
|
+
import type { TPropositionalExpression } from "@polintpro/proposit-core"
|
|
260
|
+
|
|
261
|
+
// The constructor accepts an argument without checksum — it is computed lazily.
|
|
262
|
+
const argument = {
|
|
263
|
+
id: "arg-1",
|
|
264
|
+
version: 1,
|
|
265
|
+
title: "Modus Ponens",
|
|
266
|
+
description: "",
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const eng = new ArgumentEngine(argument)
|
|
270
|
+
|
|
271
|
+
const { result: premise1 } = eng.createPremise("P implies Q") // PremiseEngine
|
|
272
|
+
const { result: premise2 } = eng.createPremise("P")
|
|
273
|
+
const { result: conclusion } = eng.createPremise("Q")
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Adding variables and expressions
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
// Variables are passed without checksum — checksums are computed lazily.
|
|
280
|
+
const varP = {
|
|
281
|
+
id: "var-p",
|
|
282
|
+
argumentId: "arg-1",
|
|
283
|
+
argumentVersion: 1,
|
|
284
|
+
symbol: "P",
|
|
285
|
+
}
|
|
286
|
+
const varQ = {
|
|
287
|
+
id: "var-q",
|
|
288
|
+
argumentId: "arg-1",
|
|
289
|
+
argumentVersion: 1,
|
|
290
|
+
symbol: "Q",
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Register variables once on the engine — they are shared across all premises
|
|
294
|
+
eng.addVariable(varP)
|
|
295
|
+
eng.addVariable(varQ)
|
|
296
|
+
|
|
297
|
+
// Premise 1: P → Q
|
|
298
|
+
premise1.addExpression({
|
|
299
|
+
id: "op-implies",
|
|
300
|
+
argumentId: "arg-1",
|
|
301
|
+
argumentVersion: 1,
|
|
302
|
+
type: "operator",
|
|
303
|
+
operator: "implies",
|
|
304
|
+
parentId: null,
|
|
305
|
+
position: POSITION_INITIAL,
|
|
306
|
+
})
|
|
307
|
+
premise1.addExpression({
|
|
308
|
+
id: "expr-p1",
|
|
309
|
+
argumentId: "arg-1",
|
|
310
|
+
argumentVersion: 1,
|
|
311
|
+
type: "variable",
|
|
312
|
+
variableId: "var-p",
|
|
313
|
+
parentId: "op-implies",
|
|
314
|
+
position: 0,
|
|
315
|
+
})
|
|
316
|
+
premise1.addExpression({
|
|
317
|
+
id: "expr-q",
|
|
318
|
+
argumentId: "arg-1",
|
|
319
|
+
argumentVersion: 1,
|
|
320
|
+
type: "variable",
|
|
321
|
+
variableId: "var-q",
|
|
322
|
+
parentId: "op-implies",
|
|
323
|
+
position: 1,
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
console.log(premise1.toDisplayString()) // (P → Q)
|
|
327
|
+
|
|
328
|
+
// Premise 2: P
|
|
329
|
+
premise2.addExpression({
|
|
330
|
+
id: "expr-p2",
|
|
331
|
+
argumentId: "arg-1",
|
|
332
|
+
argumentVersion: 1,
|
|
333
|
+
type: "variable",
|
|
334
|
+
variableId: "var-p",
|
|
335
|
+
parentId: null,
|
|
336
|
+
position: POSITION_INITIAL,
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
// Conclusion: Q
|
|
340
|
+
conclusion.addExpression({
|
|
341
|
+
id: "expr-q2",
|
|
342
|
+
argumentId: "arg-1",
|
|
343
|
+
argumentVersion: 1,
|
|
344
|
+
type: "variable",
|
|
345
|
+
variableId: "var-q",
|
|
346
|
+
parentId: null,
|
|
347
|
+
position: POSITION_INITIAL,
|
|
348
|
+
})
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Setting roles
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
// The first premise created is automatically designated as the conclusion.
|
|
355
|
+
// Supporting premises are derived automatically — any inference premise
|
|
356
|
+
// (root is implies/iff) that isn't the conclusion is automatically supporting.
|
|
357
|
+
// Use setConclusionPremise to override the auto-assigned conclusion:
|
|
358
|
+
eng.setConclusionPremise(conclusion.getId())
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Mutation results
|
|
362
|
+
|
|
363
|
+
All mutating methods on `PremiseEngine` and `ArgumentEngine` return `TCoreMutationResult<T>`, which wraps the direct result with an entity-typed changeset:
|
|
364
|
+
|
|
365
|
+
```typescript
|
|
366
|
+
const { result: pm, changes } = eng.createPremise("My premise")
|
|
367
|
+
// pm is a PremiseEngine
|
|
368
|
+
// changes.premises?.added contains the new premise data
|
|
369
|
+
|
|
370
|
+
const { result: expr, changes: exprChanges } = pm.addExpression({
|
|
371
|
+
id: "expr-1",
|
|
372
|
+
argumentId: "arg-1",
|
|
373
|
+
argumentVersion: 1,
|
|
374
|
+
type: "variable",
|
|
375
|
+
variableId: "var-p",
|
|
376
|
+
parentId: null,
|
|
377
|
+
position: POSITION_INITIAL,
|
|
378
|
+
})
|
|
379
|
+
// exprChanges.expressions?.added contains the new expression
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Evaluating an argument
|
|
383
|
+
|
|
384
|
+
The evaluation pipeline proceeds as follows:
|
|
385
|
+
|
|
386
|
+
```mermaid
|
|
387
|
+
flowchart LR
|
|
388
|
+
IN["Input\n(variable ID → true/false/null\n+ rejected expression IDs)"]
|
|
389
|
+
|
|
390
|
+
IN --> VAL{"validateEvaluability()"}
|
|
391
|
+
|
|
392
|
+
VAL -->|"fail"| FAIL["{ ok: false }\nvalidation errors"]
|
|
393
|
+
VAL -->|"pass"| CON["Evaluate\nConstraint\nPremises"]
|
|
394
|
+
|
|
395
|
+
CON --> ADM{"Admissible?\n(three-valued)"}
|
|
396
|
+
|
|
397
|
+
ADM -->|"true"| SUP["Evaluate\nSupporting\nPremises"]
|
|
398
|
+
ADM -->|"false/null"| INADM["Not admissible\n(skip)"]
|
|
399
|
+
|
|
400
|
+
SUP --> SUPR{"All supporting\ntrue?\n(three-valued)"}
|
|
401
|
+
|
|
402
|
+
SUPR -->|"true"| CONC["Evaluate\nConclusion"]
|
|
403
|
+
SUPR -->|"false/null"| NONCE["Not a\ncounterexample"]
|
|
404
|
+
|
|
405
|
+
CONC --> CONCR{"Conclusion\ntrue?\n(three-valued)"}
|
|
406
|
+
|
|
407
|
+
CONCR -->|"false"| CE["Counterexample\n(admissible + all supporting\ntrue + conclusion false)"]
|
|
408
|
+
CONCR -->|"true/null"| NONCE2["Not a\ncounterexample"]
|
|
409
|
+
|
|
410
|
+
subgraph Validity["Validity Check (all 2ⁿ assignments)"]
|
|
411
|
+
direction LR
|
|
412
|
+
VALID["No counterexamples\namong admissible\nassignments → Valid"]
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
CE --> Validity
|
|
416
|
+
NONCE --> Validity
|
|
417
|
+
NONCE2 --> Validity
|
|
418
|
+
INADM --> Validity
|
|
419
|
+
|
|
420
|
+
style FAIL fill:#ffebee,stroke:#f44336
|
|
421
|
+
style CE fill:#ffebee,stroke:#f44336
|
|
422
|
+
style NONCE fill:#e8f5e9,stroke:#4caf50
|
|
423
|
+
style NONCE2 fill:#e8f5e9,stroke:#4caf50
|
|
424
|
+
style INADM fill:#f5f5f5,stroke:#888
|
|
425
|
+
style VALID fill:#e8f5e9,stroke:#4caf50
|
|
426
|
+
style Validity fill:none,stroke:#888,stroke-dasharray: 5 5
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
Assignments use `TCoreExpressionAssignment`, which carries both variable truth values (three-valued: `true`, `false`, or `null` for unknown) and operator assignments (three-state: `"accepted"`, `"rejected"`, or absent for normal evaluation):
|
|
430
|
+
|
|
431
|
+
```typescript
|
|
432
|
+
const result = eng.evaluate({
|
|
433
|
+
variables: { "var-p": true, "var-q": true },
|
|
434
|
+
operatorAssignments: {},
|
|
435
|
+
})
|
|
436
|
+
if (result.ok) {
|
|
437
|
+
console.log(result.conclusionTrue) // true
|
|
438
|
+
console.log(result.allSupportingPremisesTrue) // true
|
|
439
|
+
console.log(result.isCounterexample) // false
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Checking validity
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
const validity = eng.checkValidity()
|
|
447
|
+
if (validity.ok) {
|
|
448
|
+
console.log(validity.isValid) // true (Modus Ponens is valid)
|
|
449
|
+
console.log(validity.counterexamples) // []
|
|
450
|
+
}
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Using with React
|
|
454
|
+
|
|
455
|
+
`ArgumentEngine` implements the `useSyncExternalStore` contract, so it works as a React external store with no additional dependencies:
|
|
456
|
+
|
|
457
|
+
```tsx
|
|
458
|
+
import { useSyncExternalStore } from "react"
|
|
459
|
+
import { ArgumentEngine } from "@polintpro/proposit-core"
|
|
460
|
+
|
|
461
|
+
// Create the engine outside of React (or in a ref/context)
|
|
462
|
+
const engine = new ArgumentEngine({ id: "arg-1", version: 1 })
|
|
463
|
+
|
|
464
|
+
function ArgumentView() {
|
|
465
|
+
// Subscribe to the full snapshot
|
|
466
|
+
const snapshot = useSyncExternalStore(engine.subscribe, engine.getSnapshot)
|
|
467
|
+
|
|
468
|
+
return (
|
|
469
|
+
<div>
|
|
470
|
+
<h2>Variables</h2>
|
|
471
|
+
<ul>
|
|
472
|
+
{Object.values(snapshot.variables).map((v) => (
|
|
473
|
+
<li key={v.id}>{v.symbol}</li>
|
|
474
|
+
))}
|
|
475
|
+
</ul>
|
|
476
|
+
<h2>Premises</h2>
|
|
477
|
+
{Object.entries(snapshot.premises).map(([id, p]) => (
|
|
478
|
+
<div key={id}>
|
|
479
|
+
Premise {id} — {Object.keys(p.expressions).length}{" "}
|
|
480
|
+
expressions
|
|
481
|
+
</div>
|
|
482
|
+
))}
|
|
483
|
+
</div>
|
|
484
|
+
)
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
For fine-grained reactivity, select a specific slice — React skips re-rendering if the reference is unchanged thanks to structural sharing:
|
|
489
|
+
|
|
490
|
+
```tsx
|
|
491
|
+
function ExpressionView({
|
|
492
|
+
premiseId,
|
|
493
|
+
expressionId,
|
|
494
|
+
}: {
|
|
495
|
+
premiseId: string
|
|
496
|
+
expressionId: string
|
|
497
|
+
}) {
|
|
498
|
+
// Only re-renders when THIS expression changes
|
|
499
|
+
const expression = useSyncExternalStore(
|
|
500
|
+
engine.subscribe,
|
|
501
|
+
() =>
|
|
502
|
+
engine.getSnapshot().premises[premiseId]?.expressions[expressionId]
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
if (!expression) return null
|
|
506
|
+
return (
|
|
507
|
+
<span>
|
|
508
|
+
{expression.type === "variable"
|
|
509
|
+
? expression.variableId
|
|
510
|
+
: expression.operator}
|
|
511
|
+
</span>
|
|
512
|
+
)
|
|
513
|
+
}
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
Mutations go through the engine as usual — subscribers are notified automatically:
|
|
517
|
+
|
|
518
|
+
```tsx
|
|
519
|
+
function AddVariableButton() {
|
|
520
|
+
return (
|
|
521
|
+
<button
|
|
522
|
+
onClick={() => {
|
|
523
|
+
engine.addVariable({
|
|
524
|
+
id: crypto.randomUUID(),
|
|
525
|
+
argumentId: "arg-1",
|
|
526
|
+
argumentVersion: 1,
|
|
527
|
+
symbol: "R",
|
|
528
|
+
})
|
|
529
|
+
}}
|
|
530
|
+
>
|
|
531
|
+
Add variable R
|
|
532
|
+
</button>
|
|
533
|
+
)
|
|
534
|
+
}
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
---
|
|
538
|
+
|
|
539
|
+
### Inserting an expression into the tree
|
|
540
|
+
|
|
541
|
+
`insertExpression` splices a new node between existing nodes. The new expression inherits the **anchor** node's current slot in the tree (`leftNodeId ?? rightNodeId`).
|
|
542
|
+
|
|
543
|
+
```typescript
|
|
544
|
+
// Extend P → Q into (P ∧ R) → Q by inserting an `and` above expr-p1.
|
|
545
|
+
const varR = {
|
|
546
|
+
id: "var-r",
|
|
547
|
+
argumentId: "arg-1",
|
|
548
|
+
argumentVersion: 1,
|
|
549
|
+
symbol: "R",
|
|
550
|
+
}
|
|
551
|
+
eng.addVariable(varR)
|
|
552
|
+
premise1.addExpression({
|
|
553
|
+
id: "expr-r",
|
|
554
|
+
argumentId: "arg-1",
|
|
555
|
+
argumentVersion: 1,
|
|
556
|
+
type: "variable",
|
|
557
|
+
variableId: "var-r",
|
|
558
|
+
parentId: null,
|
|
559
|
+
position: POSITION_INITIAL,
|
|
560
|
+
})
|
|
561
|
+
premise1.insertExpression(
|
|
562
|
+
{
|
|
563
|
+
id: "op-and",
|
|
564
|
+
argumentId: "arg-1",
|
|
565
|
+
argumentVersion: 1,
|
|
566
|
+
type: "operator",
|
|
567
|
+
operator: "and",
|
|
568
|
+
parentId: null, // overwritten by insertExpression
|
|
569
|
+
position: POSITION_INITIAL,
|
|
570
|
+
},
|
|
571
|
+
"expr-p1", // becomes child at position 0
|
|
572
|
+
"expr-r" // becomes child at position 1
|
|
573
|
+
)
|
|
574
|
+
|
|
575
|
+
console.log(premise1.toDisplayString()) // ((P ∧ R) → Q)
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
### Removing expressions
|
|
579
|
+
|
|
580
|
+
Removing an expression also removes its entire descendant subtree. After the subtree is gone, ancestor operators left with fewer than two children are automatically collapsed:
|
|
581
|
+
|
|
582
|
+
- **0 children remaining** — the operator is deleted; the check recurses upward.
|
|
583
|
+
- **1 child remaining** — the operator is deleted and that child is promoted into the operator's former slot.
|
|
584
|
+
|
|
585
|
+
```typescript
|
|
586
|
+
// Remove expr-r from the and-cluster.
|
|
587
|
+
// op-and now has only expr-p1 → op-and is deleted, expr-p1 is promoted back
|
|
588
|
+
// to position 0 under op-implies.
|
|
589
|
+
premise1.removeExpression("expr-r")
|
|
590
|
+
|
|
591
|
+
console.log(premise1.toDisplayString()) // (P → Q)
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Forking an argument
|
|
595
|
+
|
|
596
|
+
```typescript
|
|
597
|
+
// Fork John's argument to create Rich's response
|
|
598
|
+
import { PropositCore } from "@polintpro/proposit-core"
|
|
599
|
+
|
|
600
|
+
const core = new PropositCore()
|
|
601
|
+
|
|
602
|
+
// Create John's argument (engine registered in core.arguments)
|
|
603
|
+
const johnEngine = core.arguments.create({
|
|
604
|
+
id: "john-arg-id",
|
|
605
|
+
version: 1,
|
|
606
|
+
title: "John's argument",
|
|
607
|
+
description: "",
|
|
608
|
+
})
|
|
609
|
+
// ... populate with premises, variables, expressions ...
|
|
610
|
+
|
|
611
|
+
// Fork — clones claims/sources, creates fork records, registers new engine
|
|
612
|
+
const { engine: richArg, remapTable } = core.forkArgument(
|
|
613
|
+
"john-arg-id",
|
|
614
|
+
"rich-arg-id"
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
// Rich now has a mutable copy — modify, add, or remove premises
|
|
618
|
+
const forkedPremiseId = remapTable.premises.get(originalPremiseId)!
|
|
619
|
+
richArg.removePremise(forkedPremiseId) // reject a premise
|
|
620
|
+
richArg.createPremise(undefined, "RichNewPremise") // add a new one
|
|
621
|
+
|
|
622
|
+
// See what Rich changed relative to John's original (fork-aware matching is automatic)
|
|
623
|
+
const diff = core.diffArguments("john-arg-id", "rich-arg-id")
|
|
624
|
+
// diff.premises.removed — premises Rich rejected
|
|
625
|
+
// diff.premises.added — premises Rich introduced
|
|
626
|
+
// diff.premises.modified — premises Rich altered
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### Cross-argument variable binding
|
|
630
|
+
|
|
631
|
+
```typescript
|
|
632
|
+
// Rich's argument references a premise from John's argument
|
|
633
|
+
richArg.bindVariableToExternalPremise({
|
|
634
|
+
id: "v-john-p2",
|
|
635
|
+
argumentId: "rich-arg-id",
|
|
636
|
+
argumentVersion: 0,
|
|
637
|
+
symbol: "JohnP2",
|
|
638
|
+
boundPremiseId: "johns-premise-2-id",
|
|
639
|
+
boundArgumentId: "johns-arg-id",
|
|
640
|
+
boundArgumentVersion: 2, // must be a published version
|
|
641
|
+
})
|
|
642
|
+
|
|
643
|
+
// Or reference John's conclusion directly
|
|
644
|
+
richArg.bindVariableToArgument(
|
|
645
|
+
{
|
|
646
|
+
id: "v-john-conclusion",
|
|
647
|
+
argumentId: "rich-arg-id",
|
|
648
|
+
argumentVersion: 0,
|
|
649
|
+
symbol: "JohnConclusion",
|
|
650
|
+
boundArgumentId: "johns-arg-id",
|
|
651
|
+
boundArgumentVersion: 2,
|
|
652
|
+
},
|
|
653
|
+
"johns-conclusion-premise-id" // caller resolves the conclusion
|
|
654
|
+
)
|
|
655
|
+
|
|
656
|
+
// External bindings are evaluator-assigned — provide truth values in the assignment
|
|
657
|
+
const result = richArg.evaluate({
|
|
658
|
+
variables: { "v-john-p2": true, "v-john-conclusion": false },
|
|
659
|
+
operatorAssignments: {},
|
|
660
|
+
})
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
## Invalid Constructions and How They're Handled
|
|
664
|
+
|
|
665
|
+
The engine enforces structural invariants at two levels: **construction-time** (throws immediately) and **validation-time** (detected by `validateEvaluability()` before evaluation). The tables below list every invalid construction.
|
|
666
|
+
|
|
667
|
+
### Expression tree — prevented at construction time
|
|
668
|
+
|
|
669
|
+
| Invalid construction | What happens |
|
|
670
|
+
| -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
671
|
+
| `implies` or `iff` with `parentId !== null` | Throws — root-only operators must be the root of a premise's tree |
|
|
672
|
+
| Non-`not` operator as direct child of another operator | Throws — a `formula` node must sit between them (unless `autoNormalize` is `true`, which auto-inserts one) |
|
|
673
|
+
| Expression with `parentId === id` (self-parentage) | Throws |
|
|
674
|
+
| Duplicate expression ID within a premise | Throws |
|
|
675
|
+
| Expression references a non-existent `parentId` | Throws |
|
|
676
|
+
| Expression's parent is a `variable` expression | Throws — only operators and formulas can have children |
|
|
677
|
+
| `formula` node already has a child (adding a second) | Throws — formulas allow exactly one child |
|
|
678
|
+
| `not` operator already has a child (adding a second) | Throws — `not` is unary |
|
|
679
|
+
| `implies` or `iff` already has two children (adding a third) | Throws — binary operators require exactly two |
|
|
680
|
+
| Two siblings share the same `position` under the same parent | Throws |
|
|
681
|
+
| `insertExpression` with `leftNodeId === rightNodeId` | Throws |
|
|
682
|
+
| `insertExpression` or `wrapExpression` targeting a root-only operator as a child | Throws — `implies`/`iff` cannot be subordinated |
|
|
683
|
+
| `wrapExpression` with `not` as the wrapping operator | Throws — `not` is unary but wrapping always produces two children |
|
|
684
|
+
| Expression's `argumentId`/`argumentVersion` doesn't match the premise | Throws |
|
|
685
|
+
|
|
686
|
+
### Expression tree — detected by validation
|
|
687
|
+
|
|
688
|
+
| Invalid construction | Error code |
|
|
689
|
+
| --------------------------------------------------------------------- | ------------------------------- |
|
|
690
|
+
| `and` or `or` operator with fewer than 2 children | `EXPR_CHILD_COUNT_INVALID` |
|
|
691
|
+
| `not` or `formula` with 0 children | `EXPR_CHILD_COUNT_INVALID` |
|
|
692
|
+
| `implies` or `iff` without exactly 2 children with distinct positions | `EXPR_BINARY_POSITIONS_INVALID` |
|
|
693
|
+
| Expression references an undeclared variable | `EXPR_VARIABLE_UNDECLARED` |
|
|
694
|
+
|
|
695
|
+
### Variables — prevented at construction time
|
|
696
|
+
|
|
697
|
+
| Invalid construction | What happens |
|
|
698
|
+
| --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
|
|
699
|
+
| Duplicate variable `id` | Throws |
|
|
700
|
+
| Duplicate variable `symbol` | Throws |
|
|
701
|
+
| Variable `argumentId`/`argumentVersion` doesn't match the engine | Throws |
|
|
702
|
+
| Claim-bound variable references a non-existent claim/version | Throws |
|
|
703
|
+
| Premise-bound variable references a non-existent premise (internal) | Throws |
|
|
704
|
+
| Adding a premise-bound variable via `addVariable()` | Throws — use `bindVariableToPremise` or `bindVariableToExternalPremise` |
|
|
705
|
+
| Circular binding (variable → premise → expression → variable, transitively) | Throws |
|
|
706
|
+
| `bindVariableToPremise` with `boundArgumentId !== engine.argumentId` | Throws — use `bindVariableToExternalPremise` for cross-argument |
|
|
707
|
+
| `bindVariableToExternalPremise` with `boundArgumentId === engine.argumentId` | Throws — use `bindVariableToPremise` for internal |
|
|
708
|
+
| External binding rejected by `canBind()` policy | Throws |
|
|
709
|
+
| Renaming a variable to a symbol already in use | Throws |
|
|
710
|
+
| Changing a variable's binding type (claim → premise or vice versa) via `updateVariable` | Throws — delete and re-create |
|
|
711
|
+
|
|
712
|
+
### Variables — detected by validation
|
|
713
|
+
|
|
714
|
+
| Invalid construction | Error code | Severity |
|
|
715
|
+
| -------------------------------------------------- | -------------------------- | -------- |
|
|
716
|
+
| Premise-bound variable references an empty premise | `EXPR_BOUND_PREMISE_EMPTY` | Warning |
|
|
717
|
+
|
|
718
|
+
### Premises — prevented at construction time
|
|
719
|
+
|
|
720
|
+
| Invalid construction | What happens |
|
|
721
|
+
| --------------------------------------------------------------- | ------------ |
|
|
722
|
+
| Duplicate premise ID | Throws |
|
|
723
|
+
| Adding a second root expression (`parentId: null`) to a premise | Throws |
|
|
724
|
+
|
|
725
|
+
### Premises — detected by validation
|
|
726
|
+
|
|
727
|
+
| Invalid construction | Error code |
|
|
728
|
+
| ------------------------------------------------ | ----------------------- |
|
|
729
|
+
| Premise has no expressions | `PREMISE_EMPTY` |
|
|
730
|
+
| Premise has expressions but no root | `PREMISE_ROOT_MISSING` |
|
|
731
|
+
| `rootExpressionId` doesn't match the actual root | `PREMISE_ROOT_MISMATCH` |
|
|
732
|
+
|
|
733
|
+
### Argument — detected by validation
|
|
734
|
+
|
|
735
|
+
| Invalid construction | Error code |
|
|
736
|
+
| ----------------------------------------------------------- | -------------------------------------- |
|
|
737
|
+
| No conclusion premise designated | `ARGUMENT_NO_CONCLUSION` |
|
|
738
|
+
| Conclusion premise ID points to a non-existent premise | `ARGUMENT_CONCLUSION_NOT_FOUND` |
|
|
739
|
+
| Same variable ID used with multiple symbols across premises | `ARGUMENT_VARIABLE_ID_SYMBOL_MISMATCH` |
|
|
740
|
+
| Same variable symbol used with multiple IDs across premises | `ARGUMENT_VARIABLE_SYMBOL_AMBIGUOUS` |
|
|
741
|
+
|
|
742
|
+
### Removal cascades
|
|
743
|
+
|
|
744
|
+
These are not errors — they're intentional structural maintenance:
|
|
745
|
+
|
|
746
|
+
| Trigger | Cascade behavior |
|
|
747
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
748
|
+
| `removeVariable(id)` | All expressions referencing the variable are deleted across all premises, triggering operator collapse |
|
|
749
|
+
| `removePremise(id)` | All variables bound to the premise are removed (which cascades to their expressions). If the premise was the conclusion, the conclusion becomes unset. |
|
|
750
|
+
| `removeExpression(id)` | The expression's subtree is deleted. Ancestor operators with 0 remaining children are deleted. Operators with 1 remaining child promote that child into their slot (operator collapse). Promotions are checked against nesting and root-only rules. |
|
|
751
|
+
|
|
752
|
+
### Grammar configuration
|
|
753
|
+
|
|
754
|
+
Two options on `grammarConfig` control expression tree strictness:
|
|
755
|
+
|
|
756
|
+
| Option | Default | Effect |
|
|
757
|
+
| -------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
758
|
+
| `enforceFormulaBetweenOperators` | `true` | When `true`, non-`not` operators cannot be direct children of operators — a `formula` buffer is required. |
|
|
759
|
+
| `autoNormalize` | `false` | When `true`, `addExpression` auto-inserts `formula` buffers instead of throwing. Only applies to `addExpression` and `loadExpressions` — `insertExpression`, `wrapExpression`, and `removeExpression` always enforce or throw. |
|
|
760
|
+
|
|
761
|
+
`PERMISSIVE_GRAMMAR_CONFIG` (`{ enforceFormulaBetweenOperators: false, autoNormalize: false }`) is used by `fromSnapshot`/`fromData` to load previously saved trees without re-validation.
|
|
762
|
+
|
|
763
|
+
## API Reference
|
|
764
|
+
|
|
765
|
+
See [docs/api-reference.md](docs/api-reference.md) for the full API reference covering `ArgumentEngine`, `PremiseEngine`, standalone functions, position utilities, and types.
|
|
766
|
+
|
|
767
|
+
## CLI
|
|
768
|
+
|
|
769
|
+
The package ships a command-line interface for managing arguments stored on disk.
|
|
770
|
+
|
|
771
|
+
### Running the CLI
|
|
772
|
+
|
|
773
|
+
```bash
|
|
774
|
+
# From the repo, using node directly:
|
|
775
|
+
node dist/cli.js --help
|
|
776
|
+
|
|
777
|
+
# Using the npm script:
|
|
778
|
+
pnpm cli -- --help
|
|
779
|
+
|
|
780
|
+
# Link globally to get the `proposit-core` command on your PATH:
|
|
781
|
+
pnpm link --global
|
|
782
|
+
proposit-core --help
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
### State storage
|
|
786
|
+
|
|
787
|
+
All data is stored under `~/.proposit-core` by default. Override with the `PROPOSIT_HOME` environment variable:
|
|
788
|
+
|
|
789
|
+
```bash
|
|
790
|
+
PROPOSIT_HOME=/path/to/data proposit-core arguments list
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
The on-disk layout is:
|
|
794
|
+
|
|
795
|
+
```
|
|
796
|
+
$PROPOSIT_HOME/
|
|
797
|
+
arguments/
|
|
798
|
+
<argument-id>/
|
|
799
|
+
meta.json # id, title, description
|
|
800
|
+
<version>/ # one directory per version (0, 1, 2, …)
|
|
801
|
+
meta.json # version, createdAt, published, publishedAt?
|
|
802
|
+
variables.json # array of TPropositionalVariable
|
|
803
|
+
roles.json # { conclusionPremiseId? }
|
|
804
|
+
premises/
|
|
805
|
+
<premise-id>/
|
|
806
|
+
meta.json # id, title?
|
|
807
|
+
data.json # type, rootExpressionId?, variables[], expressions[]
|
|
808
|
+
<analysis>.json # named analysis files (default: analysis.json)
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
### Versioning
|
|
812
|
+
|
|
813
|
+
Arguments start at version `0`. Publishing marks the current version as immutable and copies its state to a new draft version. All mutating commands reject published versions.
|
|
814
|
+
|
|
815
|
+
Version selectors accepted anywhere a `<version>` is required:
|
|
816
|
+
|
|
817
|
+
| Selector | Resolves to |
|
|
818
|
+
| ---------------- | -------------------------------------- |
|
|
819
|
+
| `0`, `1`, … | Exact version number |
|
|
820
|
+
| `latest` | Highest version number |
|
|
821
|
+
| `last-published` | Highest version with `published: true` |
|
|
822
|
+
|
|
823
|
+
### Top-level commands
|
|
824
|
+
|
|
825
|
+
```
|
|
826
|
+
proposit-core version Print the package version
|
|
827
|
+
proposit-core arguments create <title> <desc> Create a new argument (prints UUID)
|
|
828
|
+
proposit-core arguments list [--json] List all arguments
|
|
829
|
+
proposit-core arguments delete [--all] [--confirm] <id> Delete an argument or its latest version
|
|
830
|
+
proposit-core arguments publish <id> Publish latest version, prepare new draft
|
|
831
|
+
proposit-core arguments parse [text] [options] Parse natural language into an argument via LLM
|
|
832
|
+
proposit-core arguments import <yaml_file> Import an argument from YAML
|
|
833
|
+
proposit-core claims list [--json] List all claims
|
|
834
|
+
proposit-core claims show <claim_id> [--json] Show all versions of a claim
|
|
835
|
+
proposit-core claims add [--title <t>] [--body <b>] Create a new claim
|
|
836
|
+
proposit-core claims update <claim_id> [--title <t>] [--body <b>] Update claim metadata
|
|
837
|
+
proposit-core claims freeze <claim_id> Freeze current version
|
|
838
|
+
proposit-core sources list [--json] List all sources
|
|
839
|
+
proposit-core sources show <source_id> [--json] Show all versions of a source
|
|
840
|
+
proposit-core sources add --text <text> Create a new source
|
|
841
|
+
proposit-core sources link-claim <source_id> <claim_id> Link a source to a claim
|
|
842
|
+
proposit-core sources unlink <association_id> Remove a claim-source association
|
|
843
|
+
```
|
|
844
|
+
|
|
845
|
+
By default `delete` removes only the latest version. Pass `--all` to remove the argument entirely. Both `delete` and `delete-unused` prompt for confirmation unless `--confirm` is supplied.
|
|
846
|
+
|
|
847
|
+
### Version-scoped commands
|
|
848
|
+
|
|
849
|
+
All commands below are scoped to a specific argument version:
|
|
850
|
+
|
|
851
|
+
```
|
|
852
|
+
proposit-core <argument_id> <version> <group> <subcommand> [args] [options]
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
#### show
|
|
856
|
+
|
|
857
|
+
```
|
|
858
|
+
proposit-core <id> <ver> show [--json]
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
Displays argument metadata (id, title, description, version, createdAt, published, publishedAt).
|
|
862
|
+
|
|
863
|
+
#### render
|
|
864
|
+
|
|
865
|
+
```
|
|
866
|
+
proposit-core <id> <ver> render
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
Renders the full argument with metadata. Output includes:
|
|
870
|
+
|
|
871
|
+
- **Argument header** — title and description
|
|
872
|
+
- **Premises** — one per line with formula display string and title (if present); conclusion marked with `*`
|
|
873
|
+
- **Variables** — symbol and bound claim title (or premise binding)
|
|
874
|
+
- **Claims** — ID, version, frozen status, title, and body
|
|
875
|
+
- **Sources** — ID, version, and text
|
|
876
|
+
|
|
877
|
+
Display strings use standard logical notation (¬ ∧ ∨ → ↔).
|
|
878
|
+
|
|
879
|
+
#### graph
|
|
880
|
+
|
|
881
|
+
```
|
|
882
|
+
proposit-core <id> <ver> graph [--json] [--analysis <filename>]
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
Outputs the argument as a DOT (Graphviz) directed graph. Pipe the output to `dot` to produce images:
|
|
886
|
+
|
|
887
|
+
```bash
|
|
888
|
+
proposit-core <id> <ver> graph | dot -Tsvg -o argument.svg
|
|
889
|
+
proposit-core <id> <ver> graph | dot -Tpng -o argument.png
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
The graph includes:
|
|
893
|
+
|
|
894
|
+
- **Premise clusters** — one subgraph per premise containing its expression tree; conclusion premise highlighted with bold red border
|
|
895
|
+
- **Expression nodes** — operators (diamond), formula wrappers (ellipse), variable references (box)
|
|
896
|
+
- **Variable definitions** — claim-bound (yellow) and premise-bound (blue) with binding details
|
|
897
|
+
- **Cross-premise edges** — premise-bound variables link to their bound premise cluster
|
|
898
|
+
|
|
899
|
+
With `--analysis <filename>`, evaluation results from an analysis file are overlaid:
|
|
900
|
+
|
|
901
|
+
- Expression nodes colored by truth value (green = true, red = false, gray = unknown)
|
|
902
|
+
- Rejected expressions marked with double border
|
|
903
|
+
- Premise cluster borders colored by root expression truth value
|
|
904
|
+
- Graph subtitle shows evaluation summary (admissible, counterexample, preserves truth)
|
|
905
|
+
|
|
906
|
+
#### roles
|
|
907
|
+
|
|
908
|
+
```
|
|
909
|
+
proposit-core <id> <ver> roles show [--json]
|
|
910
|
+
proposit-core <id> <ver> roles set-conclusion <premise_id>
|
|
911
|
+
proposit-core <id> <ver> roles clear-conclusion
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
Supporting premises are derived automatically from expression type (inference premises that are not the conclusion).
|
|
915
|
+
|
|
916
|
+
#### variables
|
|
917
|
+
|
|
918
|
+
```
|
|
919
|
+
proposit-core <id> <ver> variables create <symbol> [--id <variable_id>]
|
|
920
|
+
proposit-core <id> <ver> variables list [--json]
|
|
921
|
+
proposit-core <id> <ver> variables show <variable_id> [--json]
|
|
922
|
+
proposit-core <id> <ver> variables update <variable_id> --symbol <new_symbol>
|
|
923
|
+
proposit-core <id> <ver> variables delete <variable_id>
|
|
924
|
+
proposit-core <id> <ver> variables list-unused [--json]
|
|
925
|
+
proposit-core <id> <ver> variables delete-unused [--confirm] [--json]
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
`create` prints the new variable's UUID. `delete` cascade-deletes all expressions referencing the variable across every premise (including subtree deletion and operator collapse). `delete-unused` removes variables not referenced by any expression in any premise.
|
|
929
|
+
|
|
930
|
+
#### premises
|
|
931
|
+
|
|
932
|
+
```
|
|
933
|
+
proposit-core <id> <ver> premises create [--title <title>]
|
|
934
|
+
proposit-core <id> <ver> premises list [--json]
|
|
935
|
+
proposit-core <id> <ver> premises show <premise_id> [--json]
|
|
936
|
+
proposit-core <id> <ver> premises update <premise_id> --title <title>
|
|
937
|
+
proposit-core <id> <ver> premises delete [--confirm] <premise_id>
|
|
938
|
+
proposit-core <id> <ver> premises render <premise_id>
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
`create` prints the new premise's UUID. `render` outputs the expression tree as a display string (e.g. `(P → Q)`).
|
|
942
|
+
|
|
943
|
+
#### expressions
|
|
944
|
+
|
|
945
|
+
```
|
|
946
|
+
proposit-core <id> <ver> expressions create <premise_id> --type <type> [options]
|
|
947
|
+
proposit-core <id> <ver> expressions insert <premise_id> --type <type> [options]
|
|
948
|
+
proposit-core <id> <ver> expressions delete <premise_id> <expression_id>
|
|
949
|
+
proposit-core <id> <ver> expressions list <premise_id> [--json]
|
|
950
|
+
proposit-core <id> <ver> expressions show <premise_id> <expression_id> [--json]
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
Common options for `create` and `insert`:
|
|
954
|
+
|
|
955
|
+
| Option | Description |
|
|
956
|
+
| -------------------- | ---------------------------------------------------------------------- |
|
|
957
|
+
| `--type <type>` | `variable`, `operator`, or `formula` (required) |
|
|
958
|
+
| `--id <id>` | Explicit expression ID (default: generated UUID) |
|
|
959
|
+
| `--parent-id <id>` | Parent expression ID (omit for root) |
|
|
960
|
+
| `--position <n>` | Explicit numeric position (low-level escape hatch) |
|
|
961
|
+
| `--before <id>` | Insert before this sibling (computes position automatically) |
|
|
962
|
+
| `--after <id>` | Insert after this sibling (computes position automatically) |
|
|
963
|
+
| `--variable-id <id>` | Variable ID (required for `type=variable`) |
|
|
964
|
+
| `--operator <op>` | `not`, `and`, `or`, `implies`, or `iff` (required for `type=operator`) |
|
|
965
|
+
|
|
966
|
+
When none of `--position`, `--before`, or `--after` is specified, the expression is appended as the last child of the parent. `--before`/`--after` cannot be combined with `--position`.
|
|
967
|
+
|
|
968
|
+
`insert` additionally accepts `--left-node-id` and `--right-node-id` to splice the new expression between existing nodes.
|
|
969
|
+
|
|
970
|
+
#### analysis
|
|
971
|
+
|
|
972
|
+
An **analysis file** stores a variable assignment (symbol → boolean) for a specific argument version.
|
|
973
|
+
|
|
974
|
+
```
|
|
975
|
+
proposit-core <id> <ver> analysis create [filename] [--default <true|false>]
|
|
976
|
+
proposit-core <id> <ver> analysis list [--json]
|
|
977
|
+
proposit-core <id> <ver> analysis show [--file <filename>] [--json]
|
|
978
|
+
proposit-core <id> <ver> analysis set <symbol> <true|false> [--file <filename>]
|
|
979
|
+
proposit-core <id> <ver> analysis reset [--file <filename>] [--value <true|false>]
|
|
980
|
+
proposit-core <id> <ver> analysis reject <expression_id> [--file <filename>]
|
|
981
|
+
proposit-core <id> <ver> analysis accept <expression_id> [--file <filename>]
|
|
982
|
+
proposit-core <id> <ver> analysis validate-assignments [--file <filename>] [--json]
|
|
983
|
+
proposit-core <id> <ver> analysis delete [--file <filename>] [--confirm]
|
|
984
|
+
proposit-core <id> <ver> analysis evaluate [--file <filename>] [options]
|
|
985
|
+
proposit-core <id> <ver> analysis check-validity [options]
|
|
986
|
+
proposit-core <id> <ver> analysis validate-argument [--json]
|
|
987
|
+
proposit-core <id> <ver> analysis refs [--json]
|
|
988
|
+
proposit-core <id> <ver> analysis export [--json]
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
`--file` defaults to `analysis.json` throughout. Key subcommands:
|
|
992
|
+
|
|
993
|
+
- **`reject`** — marks an expression as rejected (it will evaluate to `false` and its children are skipped).
|
|
994
|
+
- **`accept`** — removes an expression from the rejected list (restores normal computation).
|
|
995
|
+
- **`evaluate`** — resolves symbol→ID, evaluates the argument, reports admissibility, counterexample status, and whether the conclusion is true.
|
|
996
|
+
- **`check-validity`** — runs the full truth-table search (`--mode first-counterexample|exhaustive`).
|
|
997
|
+
- **`validate-argument`** — checks structural readiness (conclusion set, inference premises, etc.).
|
|
998
|
+
- **`refs`** — lists every variable referenced across all premises.
|
|
999
|
+
- **`export`** — dumps the full `ArgumentEngine` state as JSON (uses `snapshot()` internally).
|
|
1000
|
+
|
|
1001
|
+
### Logging
|
|
1002
|
+
|
|
1003
|
+
All CLI invocations are logged to `~/.proposit-core/logs/cli.jsonl` (or `$PROPOSIT_HOME/logs/cli.jsonl`). Each line is a JSON object with a timestamp and event name. The `arguments parse` command additionally logs the full LLM request and response, plus dedicated error entries for validation and build failures.
|
|
1004
|
+
|
|
1005
|
+
## Development
|
|
1006
|
+
|
|
1007
|
+
```bash
|
|
1008
|
+
pnpm install
|
|
1009
|
+
pnpm run typecheck # type-check without emitting
|
|
1010
|
+
pnpm run lint # Prettier + ESLint
|
|
1011
|
+
pnpm run test # Vitest
|
|
1012
|
+
pnpm run build # compile to dist/
|
|
1013
|
+
pnpm run check # all of the above in sequence
|
|
1014
|
+
pnpm cli -- --help # run the CLI from the local build
|
|
1015
|
+
```
|
|
1016
|
+
|
|
1017
|
+
A CLI smoke test exercises every command against an isolated temp directory:
|
|
1018
|
+
|
|
1019
|
+
```bash
|
|
1020
|
+
pnpm run build && bash scripts/smoke-test.sh
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
See [CLI_EXAMPLES.md](CLI_EXAMPLES.md) for a full walkthrough.
|
|
1024
|
+
|
|
1025
|
+
## Publishing
|
|
1026
|
+
|
|
1027
|
+
Releases are published to GitHub Packages automatically. To publish a new version:
|
|
1028
|
+
|
|
1029
|
+
1. Bump `version` in `package.json`.
|
|
1030
|
+
2. Create a GitHub Release with a tag matching the version (e.g. `v0.2.0`) via `pnpm version patch`
|
|
1031
|
+
3. The [Publish workflow](.github/workflows/publish.yml) will build and publish the package or run `pnpm publish --access public`
|
|
1032
|
+
4. Push new tags with `git push --follow-tags`
|