Non-Monotonic Multi-Succedent sequent calculus — propositional NMMS from Hlobil & Brandom 2025
Project description
pyNMMS
An automated reasoner for the Non-Monotonic Multi-Succedent (NMMS) propositional sequent calculus from Hlobil & Brandom 2025, Ch. 3.
Documentation | PyPI | GitHub
Installation
pip install pyNMMS
For development:
git clone https://github.com/bradleypallen/nmms-reasoner.git
cd nmms-reasoner
pip install -e ".[dev]"
Quick Start
from pynmms import MaterialBase, NMMSReasoner
# Create a material base with defeasible inferences
base = MaterialBase(
language={"A", "B", "C"},
consequences={
(frozenset({"A"}), frozenset({"B"})), # A |~ B
(frozenset({"B"}), frozenset({"C"})), # B |~ C
},
)
reasoner = NMMSReasoner(base)
# A derives B (base consequence)
result = reasoner.derives(frozenset({"A"}), frozenset({"B"}))
assert result.derivable # True
# A does NOT derive C (nontransitivity — no [Mixed-Cut])
result = reasoner.derives(frozenset({"A"}), frozenset({"C"}))
assert not result.derivable # False
# A, C does NOT derive B (nonmonotonicity — no [Weakening])
result = reasoner.derives(frozenset({"A", "C"}), frozenset({"B"}))
assert not result.derivable # False
# Classical tautologies still hold (supraclassicality)
result = reasoner.derives(frozenset(), frozenset({"A | ~A"}))
assert result.derivable # True
CLI
# Create a base and add consequences
pynmms tell -b base.json --create "A |~ B"
pynmms tell -b base.json "B |~ C"
# Query derivability
pynmms ask -b base.json "A => B" # DERIVABLE
pynmms ask -b base.json "A => C" # NOT DERIVABLE
pynmms ask -b base.json "A, C => B" # NOT DERIVABLE
# Interactive REPL
pynmms repl -b base.json
Key Properties
- Nonmonotonicity: Adding premises can defeat inferences (no Weakening)
- Nontransitivity: Chaining good inferences can yield bad ones (no Mixed-Cut)
- Supraclassicality: All classically valid sequents are derivable
- Conservative Extension: Logical vocabulary doesn't change base-level relations
- Explicitation Conditions: DD, II, AA, SS biconditionals hold
Implementation
Proof search strategy
The reasoner uses root-first backward proof search with memoization and backtracking. This is related to but distinct from the deterministic proof-search procedure in Definition 20 of the Ch. 3 appendix. Definition 20 specifies a deterministic decomposition: find the first complex sentence (alphabetically, left side first), apply the corresponding rule, repeat until all leaves are atomic, then check axioms. Our implementation instead tries each complex sentence in sorted order with backtracking — if decomposing one sentence fails to produce a proof, it backtracks and tries the next. Both approaches are correct because all NMMS rules are invertible (Proposition 27): if a sequent is derivable, any order of rule application will find the proof. Our approach adds memoization and depth-limiting as practical safeguards.
- 8 Ketonen-style propositional rules with third top sequent (compensates for working with sets rather than multisets, per Proposition 21)
- Memoization keyed on
(frozenset, frozenset)pairs; cycle detection via pre-marking entries asFalsebefore recursion - Depth-limited (default 25) to guarantee termination
- Deterministic rule application order (sorted iteration) for reproducible results
Design decisions
- Propositional fragment only; ALC restricted quantifiers deferred
- Sets (frozensets), not multisets — Contraction is built in (per Proposition 21)
- Sentences represented as strings, parsed on demand by a recursive descent parser producing frozen
Sentencedataclass AST nodes - Base consequences use exact syntactic match — no subset/superset matching, which is what enforces the no-Weakening property
- Containment (Γ ∩ Δ ≠ ∅) checked automatically as an axiom schema
- No runtime dependencies beyond the Python standard library
Known limitations
- Depth limit can cause false negatives for deeply nested valid sequents
- No incremental/persistent cache between queries
- Multi-premise rules ([L→], [L∨], [R∧]) each generate 3 subgoals, giving worst-case exponential branching
- Flat proof trace only — no structured proof tree or proof certificates
- Formula strings re-parsed at each proof step (no pre-compilation)
- Does not implement NMMS\ctr (contraction-free variant, Section 3.2.3), Monotonicity Box (□, Section 3.3.1), or classicality operator (⌈cl⌉, Section 3.3.2)
Test suite
273 tests across 12 test files:
- Syntax parsing (29 tests), MaterialBase construction/serialization (21), individual rule correctness (17), axiom derivability (6), structural properties with deterministic bases (18: nonmonotonicity, nontransitivity, supraclassicality, DD/II/AA/SS), soundness audit checking each rule for containment-leak false positives (17), CLI integration (17), logging/tracing (9)
- 63 tests from every concrete worked example in Ch. 3 (Toy Base T, monotonicity/transitivity failures, explicitating theorems, distribution failure, meta-modus-ponens failure, Mingle-Mix failure, conservative extension)
- 17 Hypothesis property-based tests against randomly generated material bases verifying: Containment, supraclassicality schemas, DDT biconditional, no-Weakening, no-Cut, conservativity, base consequence derivability, idempotency, and serialization roundtrip
- 59 cross-validation tests against ROLE.jl ground truth across 3 material base fragments, verifying agreement between pyNMMS backward proof search and ROLE.jl exhaustive semantic enumeration
Theoretical Background
This implements the NMMS sequent calculus from:
- Hlobil, U. & Brandom, R. B. (2025). Reasons for Logic, Logic for Reasons. Ch. 3: "Introducing Logical Vocabulary."
NMMS codifies open reason relations — consequence relations where Monotonicity and Transitivity can fail. The material base encodes defeasible material inferences among atomic sentences, and the Ketonen-style logical rules extend this to compound sentences while preserving nonmonotonicity.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynmms-0.1.4.tar.gz.
File metadata
- Download URL: pynmms-0.1.4.tar.gz
- Upload date:
- Size: 59.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbca5080c361222f0cb263c8f55ab88b29814c901a9a89b58ea5bea3cfaead23
|
|
| MD5 |
9a3993ed540c3345974847fb0c7b0cac
|
|
| BLAKE2b-256 |
99b56a4b53c349f451f459a472da4b8e757a65c2ece28909b8f5dd00cd210705
|
File details
Details for the file pynmms-0.1.4-py3-none-any.whl.
File metadata
- Download URL: pynmms-0.1.4-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bc39feaa31e07aab811910e46c6807f99b3bf3cd33d40df5f04134d7e54fc45
|
|
| MD5 |
e2da1f3ba54683bc3f7efe676c89a276
|
|
| BLAKE2b-256 |
5025e940277e0b3c7331270079759a820276f4954f25fdd3fe24be4066b7ecc7
|