@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/position.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,YAAY,cAAc,CAAA;AACvC,eAAO,MAAM,YAAY,aAAa,CAAA;AACtC,eAAO,MAAM,gBAAgB,IAAI,CAAA;AAEjC,eAAO,MAAM,uBAAuB,EAAE,mBAIrC,CAAA;AAED,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const POSITION_MIN = -2147483647;
|
|
2
|
+
export const POSITION_MAX = 2147483647;
|
|
3
|
+
export const POSITION_INITIAL = 0;
|
|
4
|
+
export const DEFAULT_POSITION_CONFIG = {
|
|
5
|
+
min: POSITION_MIN,
|
|
6
|
+
max: POSITION_MAX,
|
|
7
|
+
initial: POSITION_INITIAL,
|
|
8
|
+
};
|
|
9
|
+
/** Returns the integer midpoint between two numbers, truncating toward zero. */
|
|
10
|
+
export function midpoint(a, b) {
|
|
11
|
+
return Math.trunc(a + (b - a) / 2);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=position.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.js","sourceRoot":"","sources":["../../../src/lib/utils/position.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAU,CAAA;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAA;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAEjC,MAAM,CAAC,MAAM,uBAAuB,GAAwB;IACxD,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,YAAY;IACjB,OAAO,EAAE,gBAAgB;CAC5B,CAAA;AAED,gFAAgF;AAChF,MAAM,UAAU,QAAQ,CAAC,CAAS,EAAE,CAAS;IACzC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AACtC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proposit/proposit-core",
|
|
3
|
+
"version": "0.8.9",
|
|
4
|
+
"description": "Core engine for building and manipulating propositional logic arguments.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"propositional-logic",
|
|
8
|
+
"logic-engine",
|
|
9
|
+
"argument",
|
|
10
|
+
"validation",
|
|
11
|
+
"formal-logic"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/Proposit-App/proposit-core",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=22.3.0"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./extensions/ieee": {
|
|
26
|
+
"types": "./dist/extensions/ieee/index.d.ts",
|
|
27
|
+
"import": "./dist/extensions/ieee/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./extensions/basics": {
|
|
30
|
+
"types": "./dist/extensions/basics/index.d.ts",
|
|
31
|
+
"import": "./dist/extensions/basics/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"bin": {
|
|
35
|
+
"proposit-core": "./dist/cli.js"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"skills"
|
|
40
|
+
],
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/Proposit-App/proposit-core.git"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"generate:parser": "peggy --format es -o src/lib/core/parser/formula-gen.js src/lib/core/parser/formula.peggy",
|
|
50
|
+
"build": "rm -rf dist tsconfig.build.tsbuildinfo && pnpm run generate:parser && pnpm tsc -p tsconfig.build.json && cp src/lib/core/parser/formula-gen.js dist/lib/core/parser/formula-gen.js && pnpm run docs",
|
|
51
|
+
"typecheck": "pnpm tsc -p tsconfig.json",
|
|
52
|
+
"lint": "pnpm run prettify:check && pnpm eslint .",
|
|
53
|
+
"prettify": "pnpm prettier -w .",
|
|
54
|
+
"prettify:check": "pnpm prettier --check .",
|
|
55
|
+
"test": "pnpm vitest run",
|
|
56
|
+
"check": "pnpm run typecheck && pnpm run lint && pnpm run test && pnpm run build",
|
|
57
|
+
"docs": "typedoc",
|
|
58
|
+
"cli": "node dist/cli.js",
|
|
59
|
+
"preversion": "pnpm run check",
|
|
60
|
+
"prepublishOnly": "pnpm run check"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@types/js-yaml": "^4.0.9",
|
|
64
|
+
"@types/node": "^25.5.2",
|
|
65
|
+
"eslint": "^9.28.0",
|
|
66
|
+
"eslint-plugin-check-file": "^3.3.1",
|
|
67
|
+
"eslint-plugin-n": "^17.24.0",
|
|
68
|
+
"globals": "^17.4.0",
|
|
69
|
+
"peggy": "^5.1.0",
|
|
70
|
+
"prettier": "^3.8.1",
|
|
71
|
+
"typedoc": "^0.28.18",
|
|
72
|
+
"typescript": "^6.0.2",
|
|
73
|
+
"typescript-eslint": "^8.58.0",
|
|
74
|
+
"vitest": "^4.1.2"
|
|
75
|
+
},
|
|
76
|
+
"packageManager": "pnpm@10.23.0",
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"commander": "^14.0.3",
|
|
79
|
+
"js-yaml": "^4.1.1",
|
|
80
|
+
"typebox": "^1.1.14"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: proposit-core
|
|
3
|
+
description: Use when working with the proposit-core library — building propositional logic arguments, managing premises/variables/expressions, evaluating with Kleene three-valued logic, or using the proposit-core CLI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# proposit-core
|
|
7
|
+
|
|
8
|
+
A TypeScript library and CLI for building, evaluating, and analyzing propositional logic arguments using Kleene three-valued logic.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- Building or manipulating propositional logic arguments programmatically
|
|
13
|
+
- Managing premises, variables, and expression trees
|
|
14
|
+
- Evaluating arguments under variable assignments (three-valued: true/false/null)
|
|
15
|
+
- Checking argument validity via truth-table enumeration
|
|
16
|
+
- Diffing argument versions or analyzing premise relationships
|
|
17
|
+
- Using the proposit-core CLI to manage arguments on disk
|
|
18
|
+
- Writing tests for proposit-core features
|
|
19
|
+
|
|
20
|
+
## Key Patterns
|
|
21
|
+
|
|
22
|
+
- All mutating methods return `TCoreMutationResult<T>` — destructure `{ result, changes }`
|
|
23
|
+
- Intent-based expression insertion: prefer `appendExpression`/`addExpressionRelative` over `addExpression`
|
|
24
|
+
- Supporting premises derived from expression type (no explicit assignment)
|
|
25
|
+
- Per-entity checksums are lazy (computed on read)
|
|
26
|
+
- ESM with `.js` extensions on all relative imports
|
|
27
|
+
- Typebox schemas with `Value.Parse()` for runtime validation
|
|
28
|
+
|
|
29
|
+
## Reference
|
|
30
|
+
|
|
31
|
+
- **API Usage** — `docs/api-usage.md` — Creating arguments, managing premises/variables/expressions, evaluation, validity checking, diffing, relationship analysis.
|
|
32
|
+
- **Architecture & Design** — `docs/architecture.md` — Class hierarchy, expression tree internals, midpoint positions, operator collapse, mutation changesets, checksums.
|
|
33
|
+
- **Types & Schemas** — `docs/types-schemas.md` — All exported types: expression unions, evaluation types, mutation result types, diff types, relationship types, checksum config.
|
|
34
|
+
- **Testing** — `docs/testing.md` — Test file structure, describe block conventions, fixture patterns, how to add new tests.
|
|
35
|
+
- **CLI** — `docs/cli.md` — CLI routing, state storage layout, engine hydration, version resolution, command reference.
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
# proposit-core API Reference
|
|
2
|
+
|
|
3
|
+
## 1. Creating an Argument
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { ArgumentEngine } from "@polintpro/proposit-core"
|
|
7
|
+
|
|
8
|
+
const engine = new ArgumentEngine({
|
|
9
|
+
id: "arg-1",
|
|
10
|
+
version: 0,
|
|
11
|
+
title: "My Argument",
|
|
12
|
+
description: "Description",
|
|
13
|
+
})
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- Constructor accepts `Omit<TCoreArgument, "checksum">` -- extra fields allowed (`additionalProperties: true` in schema).
|
|
17
|
+
- Optional second parameter: `{ checksumConfig?: TCoreChecksumConfig }`.
|
|
18
|
+
- Retrieve metadata: `engine.getArgument()` returns `TCoreArgument` (with checksum).
|
|
19
|
+
|
|
20
|
+
## 2. Variable Management
|
|
21
|
+
|
|
22
|
+
Variables are argument-scoped. A single `VariableManager` is shared across all premises.
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Add
|
|
26
|
+
const { result: variable, changes } = engine.addVariable({
|
|
27
|
+
id: "v1",
|
|
28
|
+
argumentId: "arg-1",
|
|
29
|
+
argumentVersion: 0,
|
|
30
|
+
symbol: "P",
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// Update (rename)
|
|
34
|
+
engine.updateVariable("v1", { symbol: "Q" })
|
|
35
|
+
|
|
36
|
+
// Remove -- cascades: deletes all referencing expressions across all premises (with operator collapse)
|
|
37
|
+
engine.removeVariable("v1")
|
|
38
|
+
|
|
39
|
+
// Read
|
|
40
|
+
engine.getVariables() // TCorePropositionalVariable[] (sorted by ID, with checksums)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Signatures:**
|
|
44
|
+
|
|
45
|
+
| Method | Returns |
|
|
46
|
+
| ------------------------------------------------ | -------------------------------------------------------------- |
|
|
47
|
+
| `engine.addVariable(variable)` | `TCoreMutationResult<TCorePropositionalVariable>` |
|
|
48
|
+
| `engine.updateVariable(variableId, { symbol? })` | `TCoreMutationResult<TCorePropositionalVariable \| undefined>` |
|
|
49
|
+
| `engine.removeVariable(variableId)` | `TCoreMutationResult<TCorePropositionalVariable \| undefined>` |
|
|
50
|
+
| `engine.getVariables()` | `TCorePropositionalVariable[]` |
|
|
51
|
+
|
|
52
|
+
**Throws:** duplicate symbol, duplicate ID, mismatched `argumentId`/`argumentVersion`.
|
|
53
|
+
|
|
54
|
+
## 3. Premise CRUD
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// Create (auto-generated UUID)
|
|
58
|
+
const { result: pm, changes } = engine.createPremise({ title: "Premise 1" })
|
|
59
|
+
|
|
60
|
+
// Create with explicit ID
|
|
61
|
+
const { result: pm2 } = engine.createPremiseWithId("p-1", {
|
|
62
|
+
title: "Premise 1",
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
// Remove
|
|
66
|
+
const { result: removedData } = engine.removePremise("p-1")
|
|
67
|
+
|
|
68
|
+
// Read
|
|
69
|
+
engine.getPremise("p-1") // PremiseManager | undefined
|
|
70
|
+
engine.hasPremise("p-1") // boolean
|
|
71
|
+
engine.listPremiseIds() // string[] (sorted)
|
|
72
|
+
engine.listPremises() // PremiseManager[] (sorted by ID)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- `extras` is `Record<string, unknown>` -- preserved via `additionalProperties` (e.g. `{ title: "..." }`).
|
|
76
|
+
- First premise created is auto-assigned as conclusion (reflected in changeset `changes.roles`).
|
|
77
|
+
|
|
78
|
+
**Signatures:**
|
|
79
|
+
|
|
80
|
+
| Method | Returns |
|
|
81
|
+
| ----------------------------------------- | ------------------------------------------------ |
|
|
82
|
+
| `engine.createPremise(extras?)` | `TCoreMutationResult<PremiseManager>` |
|
|
83
|
+
| `engine.createPremiseWithId(id, extras?)` | `TCoreMutationResult<PremiseManager>` |
|
|
84
|
+
| `engine.removePremise(premiseId)` | `TCoreMutationResult<TCorePremise \| undefined>` |
|
|
85
|
+
|
|
86
|
+
## 4. Expression Tree
|
|
87
|
+
|
|
88
|
+
### Insertion APIs (prefer the top two)
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
const pm = engine.getPremise("p-1")!
|
|
92
|
+
|
|
93
|
+
// 1. Append as last child (position auto-computed)
|
|
94
|
+
const { result: expr } = pm.appendExpression(null, {
|
|
95
|
+
id: "e-root",
|
|
96
|
+
type: "operator",
|
|
97
|
+
operator: "implies",
|
|
98
|
+
argumentId: "arg-1",
|
|
99
|
+
argumentVersion: 0,
|
|
100
|
+
parentId: null, // ignored for appendExpression -- parentId comes from first arg
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
// 2. Insert relative to sibling
|
|
104
|
+
pm.addExpressionRelative("e-sibling", "before", {
|
|
105
|
+
id: "e-new",
|
|
106
|
+
type: "variable",
|
|
107
|
+
variableId: "v1",
|
|
108
|
+
argumentId: "arg-1",
|
|
109
|
+
argumentVersion: 0,
|
|
110
|
+
parentId: "e-root", // ignored -- derived from sibling's parent
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
// 3. Low-level with explicit position
|
|
114
|
+
pm.addExpression({
|
|
115
|
+
id: "e-3",
|
|
116
|
+
type: "variable",
|
|
117
|
+
variableId: "v1",
|
|
118
|
+
argumentId: "arg-1",
|
|
119
|
+
argumentVersion: 0,
|
|
120
|
+
parentId: "e-root",
|
|
121
|
+
position: 0,
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Input types:**
|
|
126
|
+
|
|
127
|
+
- `appendExpression` and `addExpressionRelative`: `TExpressionWithoutPosition` (no `position` or `checksum`).
|
|
128
|
+
- `addExpression`: `TExpressionInput` (no `checksum`, but has `position`).
|
|
129
|
+
|
|
130
|
+
### Other mutations
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// Insert (wraps existing nodes under new operator)
|
|
134
|
+
pm.insertExpression(newOperatorExpr, leftNodeId, rightNodeId)
|
|
135
|
+
|
|
136
|
+
// Update in-place (restricted swaps: and<->or, implies<->iff)
|
|
137
|
+
pm.updateExpression("e-1", { operator: "or" })
|
|
138
|
+
pm.updateExpression("e-var", { variableId: "v2" })
|
|
139
|
+
pm.updateExpression("e-1", { position: 5 })
|
|
140
|
+
|
|
141
|
+
// Remove
|
|
142
|
+
pm.removeExpression("e-1", true) // deleteSubtree=true: delete subtree + operator collapse
|
|
143
|
+
pm.removeExpression("e-1", false) // deleteSubtree=false: promote single child into slot
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Signatures:**
|
|
147
|
+
|
|
148
|
+
| Method | Returns |
|
|
149
|
+
| -------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
150
|
+
| `pm.appendExpression(parentId, expr)` | `TCoreMutationResult<TCorePropositionalExpression>` |
|
|
151
|
+
| `pm.addExpressionRelative(siblingId, "before"\|"after", expr)` | `TCoreMutationResult<TCorePropositionalExpression>` |
|
|
152
|
+
| `pm.addExpression(expr)` | `TCoreMutationResult<TCorePropositionalExpression>` |
|
|
153
|
+
| `pm.insertExpression(expr, leftNodeId?, rightNodeId?)` | `TCoreMutationResult<TCorePropositionalExpression>` |
|
|
154
|
+
| `pm.updateExpression(id, updates)` | `TCoreMutationResult<TCorePropositionalExpression>` |
|
|
155
|
+
| `pm.removeExpression(id, deleteSubtree)` | `TCoreMutationResult<TCorePropositionalExpression \| undefined>` |
|
|
156
|
+
|
|
157
|
+
**Read methods:**
|
|
158
|
+
|
|
159
|
+
| Method | Returns |
|
|
160
|
+
| ---------------------------------- | ----------------------------------------------------- |
|
|
161
|
+
| `pm.getExpression(id)` | `TCorePropositionalExpression \| undefined` |
|
|
162
|
+
| `pm.getExpressions()` | `TCorePropositionalExpression[]` (sorted by ID) |
|
|
163
|
+
| `pm.getChildExpressions(parentId)` | `TCorePropositionalExpression[]` (sorted by position) |
|
|
164
|
+
| `pm.getRootExpression()` | `TCorePropositionalExpression \| undefined` |
|
|
165
|
+
| `pm.getRootExpressionId()` | `string \| undefined` |
|
|
166
|
+
|
|
167
|
+
### Expression type rules
|
|
168
|
+
|
|
169
|
+
- `implies` and `iff` must be root (`parentId: null`). Cannot be nested.
|
|
170
|
+
- `not`: exactly 1 child. Cannot swap operator (delete and re-create instead).
|
|
171
|
+
- `and`/`or`: 2+ children. Can swap between each other.
|
|
172
|
+
- `implies`/`iff`: exactly 2 children at positions 0 and 1. Can swap between each other.
|
|
173
|
+
- `formula`: transparent unary wrapper (1 child). Equivalent to parentheses.
|
|
174
|
+
|
|
175
|
+
### Operator collapse (on remove with `deleteSubtree: true`)
|
|
176
|
+
|
|
177
|
+
After deleting a subtree, `collapseIfNeeded` runs on the parent:
|
|
178
|
+
|
|
179
|
+
- **0 children left**: parent operator/formula deleted, recurse to grandparent.
|
|
180
|
+
- **1 child left**: parent deleted, surviving child promoted into parent's slot.
|
|
181
|
+
|
|
182
|
+
## 5. Roles
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
engine.setConclusionPremise("p-1")
|
|
186
|
+
engine.clearConclusionPremise()
|
|
187
|
+
engine.getConclusionPremise() // PremiseManager | undefined
|
|
188
|
+
engine.listSupportingPremises() // PremiseManager[] -- derived: inference premises not the conclusion
|
|
189
|
+
engine.getRoleState() // TCoreArgumentRoleState: { conclusionPremiseId?: string }
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
- Supporting premises are **derived**, not explicitly managed. Any inference premise (`implies`/`iff` root) that is not the conclusion is automatically supporting.
|
|
193
|
+
- `setConclusionPremise` and `clearConclusionPremise` return `TCoreMutationResult<TCoreArgumentRoleState>`.
|
|
194
|
+
|
|
195
|
+
## 6. Evaluation
|
|
196
|
+
|
|
197
|
+
### Premise-level
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
const result = pm.evaluate({
|
|
201
|
+
variables: { v1: true, v2: false, v3: null },
|
|
202
|
+
rejectedExpressionIds: ["e-5"],
|
|
203
|
+
})
|
|
204
|
+
// result: TCorePremiseEvaluationResult
|
|
205
|
+
// result.rootValue -- TCoreTrivalentValue (true | false | null)
|
|
206
|
+
// result.expressionValues -- Record<string, TCoreTrivalentValue>
|
|
207
|
+
// result.inferenceDiagnostic -- for implies/iff roots
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Argument-level
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
const result = engine.evaluate({
|
|
214
|
+
variables: { v1: true, v2: false },
|
|
215
|
+
rejectedExpressionIds: [],
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
if (result.ok) {
|
|
219
|
+
result.isAdmissibleAssignment // TCoreTrivalentValue
|
|
220
|
+
result.allSupportingPremisesTrue // TCoreTrivalentValue
|
|
221
|
+
result.conclusionTrue // TCoreTrivalentValue
|
|
222
|
+
result.isCounterexample // TCoreTrivalentValue
|
|
223
|
+
result.preservesTruthUnderAssignment // TCoreTrivalentValue
|
|
224
|
+
result.conclusion // TCorePremiseEvaluationResult
|
|
225
|
+
result.supportingPremises // TCorePremiseEvaluationResult[]
|
|
226
|
+
result.constraintPremises // TCorePremiseEvaluationResult[]
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Options:** `engine.evaluate(assignment, { validateFirst?, includeExpressionValues?, includeDiagnostics?, strictUnknownAssignmentKeys? })`
|
|
231
|
+
|
|
232
|
+
### Validity check
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
const result = engine.checkValidity({
|
|
236
|
+
mode: "firstCounterexample", // or "exhaustive"
|
|
237
|
+
maxVariables: 20,
|
|
238
|
+
maxAssignmentsChecked: 1_000_000,
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
if (result.ok) {
|
|
242
|
+
result.isValid // true | false | undefined (undefined = truncated)
|
|
243
|
+
result.counterexamples // TCoreCounterexample[]
|
|
244
|
+
result.checkedVariableIds // string[]
|
|
245
|
+
result.numAssignmentsChecked
|
|
246
|
+
result.numAdmissibleAssignments
|
|
247
|
+
result.truncated // boolean
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Structural validation
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
const validation = engine.validateEvaluability()
|
|
255
|
+
// validation: TCoreValidationResult { ok: boolean, issues: TCoreValidationIssue[] }
|
|
256
|
+
// Also: pm.validateEvaluability() for premise-level
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## 7. Diffing
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import {
|
|
263
|
+
diffArguments,
|
|
264
|
+
defaultCompareArgument,
|
|
265
|
+
defaultCompareVariable,
|
|
266
|
+
defaultComparePremise,
|
|
267
|
+
defaultCompareExpression,
|
|
268
|
+
} from "@polintpro/proposit-core"
|
|
269
|
+
|
|
270
|
+
const diff = diffArguments(engineA, engineB, {
|
|
271
|
+
compareArgument: defaultCompareArgument,
|
|
272
|
+
compareVariable: defaultCompareVariable,
|
|
273
|
+
comparePremise: defaultComparePremise,
|
|
274
|
+
compareExpression: defaultCompareExpression,
|
|
275
|
+
})
|
|
276
|
+
// diff: TCoreArgumentDiff
|
|
277
|
+
// diff.argument -- TCoreEntityFieldDiff<TCoreArgument>
|
|
278
|
+
// diff.variables -- TCoreEntitySetDiff<TCorePropositionalVariable>
|
|
279
|
+
// diff.premises -- TCorePremiseSetDiff (with nested expression diffs)
|
|
280
|
+
// diff.roles -- TCoreRoleDiff
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
- Standalone function. Pluggable comparators (each receives before/after, returns `TCoreFieldChange[]`).
|
|
284
|
+
- All options optional -- defaults are used when omitted.
|
|
285
|
+
|
|
286
|
+
## 8. Relationship Analysis
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
import {
|
|
290
|
+
analyzePremiseRelationships,
|
|
291
|
+
buildPremiseProfile,
|
|
292
|
+
} from "@polintpro/proposit-core"
|
|
293
|
+
|
|
294
|
+
// Analyze how all premises relate to a focused premise
|
|
295
|
+
const analysis = analyzePremiseRelationships(engine, "p-conclusion")
|
|
296
|
+
// analysis: TCorePremiseRelationshipAnalysis
|
|
297
|
+
// analysis.focusedPremiseId
|
|
298
|
+
// analysis.premises -- TCorePremiseRelationResult[] per other premise
|
|
299
|
+
// each: { premiseId, relationship, variableDetails, transitive }
|
|
300
|
+
// relationship: "supporting" | "contradicting" | "restricting" | "downstream" | "unrelated"
|
|
301
|
+
|
|
302
|
+
// Build a variable profile for a single premise
|
|
303
|
+
const profile = buildPremiseProfile(pm)
|
|
304
|
+
// profile: TCorePremiseProfile
|
|
305
|
+
// profile.premiseId
|
|
306
|
+
// profile.appearances -- TCoreVariableAppearance[]
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Both are standalone functions.
|
|
310
|
+
|
|
311
|
+
## 9. Formula Parsing
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
import { parseFormula } from "@polintpro/proposit-core"
|
|
315
|
+
import type { FormulaAST } from "@polintpro/proposit-core"
|
|
316
|
+
|
|
317
|
+
const ast: FormulaAST = parseFormula("P -> (Q & R)")
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Supported syntax:** `&&`/`∧` (AND), `||`/`∨` (OR), `!`/`¬` (NOT), `->`/`→` (implies), `<->`/`↔` (iff), parentheses.
|
|
321
|
+
|
|
322
|
+
**AST types:**
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
type FormulaAST =
|
|
326
|
+
| { type: "variable"; name: string }
|
|
327
|
+
| { type: "not"; operand: FormulaAST }
|
|
328
|
+
| { type: "and"; operands: FormulaAST[] }
|
|
329
|
+
| { type: "or"; operands: FormulaAST[] }
|
|
330
|
+
| { type: "implies"; left: FormulaAST; right: FormulaAST }
|
|
331
|
+
| { type: "iff"; left: FormulaAST; right: FormulaAST }
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## 10. Mutation Result Pattern
|
|
335
|
+
|
|
336
|
+
Every mutating method returns `TCoreMutationResult<T>`:
|
|
337
|
+
|
|
338
|
+
```typescript
|
|
339
|
+
interface TCoreMutationResult<T> {
|
|
340
|
+
result: T
|
|
341
|
+
changes: TCoreChangeset
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
interface TCoreChangeset {
|
|
345
|
+
expressions?: TCoreEntityChanges<TCorePropositionalExpression>
|
|
346
|
+
variables?: TCoreEntityChanges<TCorePropositionalVariable>
|
|
347
|
+
premises?: TCoreEntityChanges<TCorePremise>
|
|
348
|
+
roles?: TCoreArgumentRoleState // present only when roles changed
|
|
349
|
+
argument?: TCoreArgument // present only when argument changed
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
interface TCoreEntityChanges<T> {
|
|
353
|
+
added: T[]
|
|
354
|
+
modified: T[]
|
|
355
|
+
removed: T[]
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
**Usage pattern:**
|
|
360
|
+
|
|
361
|
+
```typescript
|
|
362
|
+
const { result: premise, changes } = engine.createPremise()
|
|
363
|
+
changes.premises?.added // newly added premise
|
|
364
|
+
changes.roles // new role state (if changed, e.g. auto-conclusion)
|
|
365
|
+
changes.expressions?.removed // cascaded removals (e.g. from removeVariable)
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## 11. Serialization
|
|
369
|
+
|
|
370
|
+
### PremiseManager
|
|
371
|
+
|
|
372
|
+
| Method | Returns | Description |
|
|
373
|
+
| ------------------------------------------ | ----------------------------------------------------- | ------------------------------------------------- |
|
|
374
|
+
| `pm.toData()` | `TCorePremise` | Serializable snapshot (only referenced variables) |
|
|
375
|
+
| `pm.toDisplayString()` | `string` | Human-readable formula (`P -> (Q /\ R)`) |
|
|
376
|
+
| `pm.isInference()` | `boolean` | Root is `implies` or `iff` |
|
|
377
|
+
| `pm.isConstraint()` | `boolean` | Not an inference (inverse of above) |
|
|
378
|
+
| `pm.checksum()` | `string` | Premise-level checksum (lazy) |
|
|
379
|
+
| `pm.getId()` | `string` | Premise ID |
|
|
380
|
+
| `pm.getExtras()` | `Record<string, unknown>` | Extra fields (e.g. title) |
|
|
381
|
+
| `pm.setExtras(extras)` | `TCoreMutationResult<Record<string, unknown>>` | Replace extras |
|
|
382
|
+
| `pm.getReferencedVariableIds()` | `Set<string>` | Variable IDs used in expressions |
|
|
383
|
+
| `pm.getVariables()` | `TCorePropositionalVariable[]` | All argument-level variables |
|
|
384
|
+
| `pm.deleteExpressionsUsingVariable(varId)` | `TCoreMutationResult<TCorePropositionalExpression[]>` | Cascade delete |
|
|
385
|
+
|
|
386
|
+
### ArgumentEngine
|
|
387
|
+
|
|
388
|
+
| Method | Returns | Description |
|
|
389
|
+
| ------------------------------------- | --------------------------------- | ------------------------------- |
|
|
390
|
+
| `engine.toData()` | `TCoreArgumentEngineData` | Full state snapshot |
|
|
391
|
+
| `engine.exportState()` | `TCoreArgumentEngineData` | Alias for `toData()` |
|
|
392
|
+
| `engine.getArgument()` | `TCoreArgument` | Argument metadata with checksum |
|
|
393
|
+
| `engine.checksum()` | `string` | Argument-level checksum (lazy) |
|
|
394
|
+
| `engine.collectReferencedVariables()` | `{ variableIds, byId, bySymbol }` | Cross-premise variable index |
|
|
395
|
+
|
|
396
|
+
## 12. Checksum Utilities
|
|
397
|
+
|
|
398
|
+
```typescript
|
|
399
|
+
import {
|
|
400
|
+
computeHash,
|
|
401
|
+
canonicalSerialize,
|
|
402
|
+
entityChecksum,
|
|
403
|
+
DEFAULT_CHECKSUM_CONFIG,
|
|
404
|
+
createChecksumConfig,
|
|
405
|
+
} from "@polintpro/proposit-core"
|
|
406
|
+
|
|
407
|
+
// Low-level hash
|
|
408
|
+
const hash = computeHash("input string")
|
|
409
|
+
|
|
410
|
+
// Serialize object to canonical deterministic JSON (sorted keys)
|
|
411
|
+
const serialized = canonicalSerialize({ a: 1, b: 2 })
|
|
412
|
+
|
|
413
|
+
// Entity checksum
|
|
414
|
+
const checksum = entityChecksum(entity, new Set(["id", "symbol"]))
|
|
415
|
+
|
|
416
|
+
// Custom config
|
|
417
|
+
const config = createChecksumConfig({
|
|
418
|
+
expressionFields: new Set([
|
|
419
|
+
"id",
|
|
420
|
+
"type",
|
|
421
|
+
"operator",
|
|
422
|
+
"variableId",
|
|
423
|
+
"parentId",
|
|
424
|
+
"position",
|
|
425
|
+
]),
|
|
426
|
+
variableFields: new Set(["id", "symbol"]),
|
|
427
|
+
})
|
|
428
|
+
const engine = new ArgumentEngine(arg, { checksumConfig: config })
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## 13. Position Utilities
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
import {
|
|
435
|
+
POSITION_MIN, // 0
|
|
436
|
+
POSITION_MAX, // Number.MAX_SAFE_INTEGER
|
|
437
|
+
POSITION_INITIAL, // midpoint(POSITION_MIN, POSITION_MAX)
|
|
438
|
+
midpoint, // (a, b) => a + (b - a) / 2
|
|
439
|
+
} from "@polintpro/proposit-core"
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Positions are opaque numbers. Only relative ordering matters. The `appendExpression` and `addExpressionRelative` APIs compute positions automatically -- prefer those over manual positioning.
|