unicode-logic-kit 0.31.0__py3-none-any.whl
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.
- unicode_logic_kit/__init__.py +385 -0
- unicode_logic_kit/__main__.py +520 -0
- unicode_logic_kit/_deadline.py +219 -0
- unicode_logic_kit/ace/__init__.py +126 -0
- unicode_logic_kit/ace/_align.py +135 -0
- unicode_logic_kit/ace/chem_lexicon.py +128 -0
- unicode_logic_kit/ace/drs_reader.py +570 -0
- unicode_logic_kit/ace/mapping.py +666 -0
- unicode_logic_kit/ace/reverse_modal.py +138 -0
- unicode_logic_kit/ace/runner.py +551 -0
- unicode_logic_kit/ace/translate.py +452 -0
- unicode_logic_kit/ace/verbalize.py +1070 -0
- unicode_logic_kit/api.py +1284 -0
- unicode_logic_kit/atp/__init__.py +177 -0
- unicode_logic_kit/atp/_ascii_names.py +113 -0
- unicode_logic_kit/atp/_html.py +72 -0
- unicode_logic_kit/atp/_substructural_input.py +228 -0
- unicode_logic_kit/atp/_tff_problem.py +715 -0
- unicode_logic_kit/atp/_tptp_problem.py +1111 -0
- unicode_logic_kit/atp/_writer_support.py +289 -0
- unicode_logic_kit/atp/clingo_backend.py +1180 -0
- unicode_logic_kit/atp/cvc5_backend.py +1385 -0
- unicode_logic_kit/atp/eprover_backend.py +732 -0
- unicode_logic_kit/atp/finite_domain.py +1055 -0
- unicode_logic_kit/atp/fitch.py +1547 -0
- unicode_logic_kit/atp/fitch_search.py +551 -0
- unicode_logic_kit/atp/hets_backend.py +339 -0
- unicode_logic_kit/atp/hybrid_down.py +120 -0
- unicode_logic_kit/atp/incremental.py +250 -0
- unicode_logic_kit/atp/kripke_enum.py +741 -0
- unicode_logic_kit/atp/lambek.py +436 -0
- unicode_logic_kit/atp/leo3_backend.py +332 -0
- unicode_logic_kit/atp/linear.py +738 -0
- unicode_logic_kit/atp/lj.py +705 -0
- unicode_logic_kit/atp/logic_backends.py +566 -0
- unicode_logic_kit/atp/ltl_tableau.py +1084 -0
- unicode_logic_kit/atp/minizinc_backend.py +1402 -0
- unicode_logic_kit/atp/modal_tableau.py +1382 -0
- unicode_logic_kit/atp/nanocop_backend.py +410 -0
- unicode_logic_kit/atp/portfolio.py +489 -0
- unicode_logic_kit/atp/protocol.py +1803 -0
- unicode_logic_kit/atp/prover9_entailment.py +1153 -0
- unicode_logic_kit/atp/resolution.py +1376 -0
- unicode_logic_kit/atp/resolution_check.py +1114 -0
- unicode_logic_kit/atp/sequent.py +1050 -0
- unicode_logic_kit/atp/tableau.py +921 -0
- unicode_logic_kit/atp/tableau_check.py +543 -0
- unicode_logic_kit/atp/tptp_ncl.py +811 -0
- unicode_logic_kit/atp/tptp_tff.py +1546 -0
- unicode_logic_kit/atp/tstp.py +1333 -0
- unicode_logic_kit/atp/tstp_check.py +1096 -0
- unicode_logic_kit/atp/twee_backend.py +236 -0
- unicode_logic_kit/atp/twee_check.py +711 -0
- unicode_logic_kit/atp/twee_entailment.py +953 -0
- unicode_logic_kit/atp/vampire_entailment.py +540 -0
- unicode_logic_kit/atp/z3_arith.py +470 -0
- unicode_logic_kit/atp/z3_equivalence.py +36 -0
- unicode_logic_kit/atp/z3_fuzzy.py +362 -0
- unicode_logic_kit/atp/z3_input.py +500 -0
- unicode_logic_kit/atp/z3_models.py +208 -0
- unicode_logic_kit/chem/__init__.py +88 -0
- unicode_logic_kit/chem/_naming.py +284 -0
- unicode_logic_kit/chem/cache.py +185 -0
- unicode_logic_kit/chem/interop.py +244 -0
- unicode_logic_kit/chem/mol.py +525 -0
- unicode_logic_kit/chem/signature.py +112 -0
- unicode_logic_kit/comorphism.py +497 -0
- unicode_logic_kit/dl/__init__.py +384 -0
- unicode_logic_kit/dl/classification.py +227 -0
- unicode_logic_kit/dl/concepts.py +632 -0
- unicode_logic_kit/dl/datatypes.py +818 -0
- unicode_logic_kit/dl/owl_functional.py +2433 -0
- unicode_logic_kit/dl/owl_manchester.py +1637 -0
- unicode_logic_kit/dl/owl_reasoner.py +790 -0
- unicode_logic_kit/dl/parser.py +391 -0
- unicode_logic_kit/dl/tableau.py +4048 -0
- unicode_logic_kit/dl/translate.py +2704 -0
- unicode_logic_kit/drt/__init__.py +94 -0
- unicode_logic_kit/drt/export.py +179 -0
- unicode_logic_kit/drt/nodes.py +506 -0
- unicode_logic_kit/drt/parser.py +965 -0
- unicode_logic_kit/drt/resolve.py +195 -0
- unicode_logic_kit/drt/reverse.py +175 -0
- unicode_logic_kit/eval/__init__.py +106 -0
- unicode_logic_kit/eval/batch.py +382 -0
- unicode_logic_kit/eval/canonical.py +663 -0
- unicode_logic_kit/eval/chem_batch.py +606 -0
- unicode_logic_kit/eval/converses.py +200 -0
- unicode_logic_kit/eval/datasets/__init__.py +136 -0
- unicode_logic_kit/eval/datasets/_base.py +263 -0
- unicode_logic_kit/eval/datasets/_proofwriter_proof.py +422 -0
- unicode_logic_kit/eval/datasets/c3po.py +678 -0
- unicode_logic_kit/eval/datasets/folio.py +158 -0
- unicode_logic_kit/eval/datasets/fracas.py +418 -0
- unicode_logic_kit/eval/datasets/groves.py +191 -0
- unicode_logic_kit/eval/datasets/logicbench.py +467 -0
- unicode_logic_kit/eval/datasets/logicnli.py +303 -0
- unicode_logic_kit/eval/datasets/malls.py +133 -0
- unicode_logic_kit/eval/datasets/pfolio.py +594 -0
- unicode_logic_kit/eval/datasets/pmb.py +242 -0
- unicode_logic_kit/eval/datasets/prontoqa.py +611 -0
- unicode_logic_kit/eval/datasets/proofwriter.py +1431 -0
- unicode_logic_kit/eval/datasets/proverqa.py +674 -0
- unicode_logic_kit/eval/datasets/willow.py +478 -0
- unicode_logic_kit/eval/equivalence.py +466 -0
- unicode_logic_kit/eval/exercise_gen.py +533 -0
- unicode_logic_kit/eval/explain.py +791 -0
- unicode_logic_kit/eval/generality.py +750 -0
- unicode_logic_kit/eval/metric_hf.py +458 -0
- unicode_logic_kit/eval/predicate_match.py +343 -0
- unicode_logic_kit/eval/theory_check.py +1170 -0
- unicode_logic_kit/eval/validate.py +306 -0
- unicode_logic_kit/fol/__init__.py +177 -0
- unicode_logic_kit/fol/_atom_keys.py +510 -0
- unicode_logic_kit/fol/_fol_nodes.py +3586 -0
- unicode_logic_kit/fol/_free_parameters.py +105 -0
- unicode_logic_kit/fol/_ho_nodes.py +448 -0
- unicode_logic_kit/fol/_hybrid_nodes.py +308 -0
- unicode_logic_kit/fol/_identifiers.py +1091 -0
- unicode_logic_kit/fol/_lambek_nodes.py +112 -0
- unicode_logic_kit/fol/_linear_nodes.py +352 -0
- unicode_logic_kit/fol/_modal_nodes.py +1467 -0
- unicode_logic_kit/fol/_msfl_nodes.py +2196 -0
- unicode_logic_kit/fol/_numeral_symbols.py +231 -0
- unicode_logic_kit/fol/_so_nodes.py +200 -0
- unicode_logic_kit/fol/_symbol_names.py +81 -0
- unicode_logic_kit/fol/_team_nodes.py +181 -0
- unicode_logic_kit/fol/_tptp_symbols.py +551 -0
- unicode_logic_kit/fol/_truth_constants.py +117 -0
- unicode_logic_kit/fol/casl_export.py +1135 -0
- unicode_logic_kit/fol/casl_import.py +929 -0
- unicode_logic_kit/fol/derivation.py +367 -0
- unicode_logic_kit/fol/dialect_detect.py +70 -0
- unicode_logic_kit/fol/dialect_repair.py +537 -0
- unicode_logic_kit/fol/frames.py +637 -0
- unicode_logic_kit/fol/grammars/terminals.lark +31 -0
- unicode_logic_kit/fol/lambda_tools.py +297 -0
- unicode_logic_kit/fol/latex_input.py +429 -0
- unicode_logic_kit/fol/modal_translation.py +944 -0
- unicode_logic_kit/fol/msflparser.py +1033 -0
- unicode_logic_kit/fol/naming.py +422 -0
- unicode_logic_kit/fol/nodes.py +241 -0
- unicode_logic_kit/fol/normalforms.py +492 -0
- unicode_logic_kit/fol/pal.py +287 -0
- unicode_logic_kit/fol/prolog_export.py +566 -0
- unicode_logic_kit/fol/prolog_input.py +505 -0
- unicode_logic_kit/fol/prover9_input.py +1325 -0
- unicode_logic_kit/fol/qml.py +1760 -0
- unicode_logic_kit/fol/qmltp_input.py +525 -0
- unicode_logic_kit/fol/sanitize.py +221 -0
- unicode_logic_kit/fol/serialize.py +79 -0
- unicode_logic_kit/fol/signature.py +1290 -0
- unicode_logic_kit/fol/simplify_check.py +544 -0
- unicode_logic_kit/fol/spans.py +594 -0
- unicode_logic_kit/fol/tptp_input.py +1503 -0
- unicode_logic_kit/fol/tptp_repair.py +941 -0
- unicode_logic_kit/fol/unification.py +157 -0
- unicode_logic_kit/fol/verbalize.py +263 -0
- unicode_logic_kit/hets/__init__.py +163 -0
- unicode_logic_kit/hets/bridge.py +142 -0
- unicode_logic_kit/hets/client.py +748 -0
- unicode_logic_kit/hets/docker.py +420 -0
- unicode_logic_kit/hets/dol.py +712 -0
- unicode_logic_kit/hets/haskell_json.py +355 -0
- unicode_logic_kit/hets/owl_backend.py +794 -0
- unicode_logic_kit/hets/owl_cli.py +598 -0
- unicode_logic_kit/hets/symbols.py +512 -0
- unicode_logic_kit/hol/__init__.py +140 -0
- unicode_logic_kit/hol/_ho_common.py +323 -0
- unicode_logic_kit/hol/_isabelle_binders.py +125 -0
- unicode_logic_kit/hol/classical.py +812 -0
- unicode_logic_kit/hol/deepshallow/__init__.py +45 -0
- unicode_logic_kit/hol/deepshallow/_common.py +177 -0
- unicode_logic_kit/hol/deepshallow/conditional.py +225 -0
- unicode_logic_kit/hol/deepshallow/intuitionistic.py +181 -0
- unicode_logic_kit/hol/deepshallow/modal.py +217 -0
- unicode_logic_kit/hol/deepshallow/qml.py +406 -0
- unicode_logic_kit/hol/deepshallow/relevant.py +206 -0
- unicode_logic_kit/hol/free.py +753 -0
- unicode_logic_kit/hol/goedel.py +336 -0
- unicode_logic_kit/hol/ho_modal.py +1743 -0
- unicode_logic_kit/hol/intuitionistic.py +403 -0
- unicode_logic_kit/hol/isabelle_conditional.py +593 -0
- unicode_logic_kit/hol/isabelle_modal.py +1908 -0
- unicode_logic_kit/hol/isabelle_relevant.py +412 -0
- unicode_logic_kit/hol/isabelle_runner.py +1147 -0
- unicode_logic_kit/hol/isabelle_substructural.py +884 -0
- unicode_logic_kit/hol/lean.py +1018 -0
- unicode_logic_kit/hol/manyvalued.py +921 -0
- unicode_logic_kit/hol/secondorder.py +687 -0
- unicode_logic_kit/hol/thf_modal.py +941 -0
- unicode_logic_kit/hol/thirdorder.py +397 -0
- unicode_logic_kit/ilp/__init__.py +89 -0
- unicode_logic_kit/ilp/readback.py +389 -0
- unicode_logic_kit/ilp/separation.py +153 -0
- unicode_logic_kit/ilp/task.py +730 -0
- unicode_logic_kit/logic.py +163 -0
- unicode_logic_kit/mcp/__init__.py +28 -0
- unicode_logic_kit/mcp/__main__.py +5 -0
- unicode_logic_kit/mcp/chem_tools.py +1031 -0
- unicode_logic_kit/mcp/server.py +2453 -0
- unicode_logic_kit/mcp/syntax_spec.py +681 -0
- unicode_logic_kit/prob/__init__.py +53 -0
- unicode_logic_kit/prob/_bdd.py +225 -0
- unicode_logic_kit/prob/_column_gen.py +668 -0
- unicode_logic_kit/prob/distribution.py +686 -0
- unicode_logic_kit/prob/nilsson.py +470 -0
- unicode_logic_kit/py.typed +0 -0
- unicode_logic_kit/semantics/__init__.py +137 -0
- unicode_logic_kit/semantics/_modal_reject.py +156 -0
- unicode_logic_kit/semantics/action_models.py +466 -0
- unicode_logic_kit/semantics/asp_models.py +1200 -0
- unicode_logic_kit/semantics/conditional.py +580 -0
- unicode_logic_kit/semantics/dynamic_epistemic.py +95 -0
- unicode_logic_kit/semantics/free_logic.py +913 -0
- unicode_logic_kit/semantics/fuzzy.py +384 -0
- unicode_logic_kit/semantics/fuzzy_kripke.py +442 -0
- unicode_logic_kit/semantics/intuitionistic.py +581 -0
- unicode_logic_kit/semantics/kripke.py +1139 -0
- unicode_logic_kit/semantics/manyvalued.py +580 -0
- unicode_logic_kit/semantics/matrix.py +342 -0
- unicode_logic_kit/semantics/model_eval.py +1135 -0
- unicode_logic_kit/semantics/modelfinder.py +1036 -0
- unicode_logic_kit/semantics/nonmonotonic.py +372 -0
- unicode_logic_kit/semantics/relevant.py +331 -0
- unicode_logic_kit/semantics/secondorder.py +657 -0
- unicode_logic_kit/semantics/structures.py +352 -0
- unicode_logic_kit/semantics/tarski.py +975 -0
- unicode_logic_kit/semantics/team.py +315 -0
- unicode_logic_kit/semantics/team_translation.py +416 -0
- unicode_logic_kit/semantics/thirdorder.py +358 -0
- unicode_logic_kit/semantics/tnorm.py +85 -0
- unicode_logic_kit/semantics/truthtable.py +201 -0
- unicode_logic_kit-0.31.0.dist-info/METADATA +333 -0
- unicode_logic_kit-0.31.0.dist-info/RECORD +237 -0
- unicode_logic_kit-0.31.0.dist-info/WHEEL +4 -0
- unicode_logic_kit-0.31.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""Logics as first-class values, and terms that carry their own side conditions.
|
|
2
|
+
|
|
3
|
+
The kit's translations live in :mod:`unicode_logic_kit.comorphism` as a graph of
|
|
4
|
+
edges. This module is the typed surface over that graph: a logic is a value you
|
|
5
|
+
can call, and calling it converts::
|
|
6
|
+
|
|
7
|
+
from unicode_logic_kit.logic import FOL, MODAL, MSFOL
|
|
8
|
+
|
|
9
|
+
f = MODAL(parse("Ⓖ(P) → P")) # a Sentence in the modal logic
|
|
10
|
+
g = FOL(f) # converted, with its side conditions
|
|
11
|
+
api.prove(g) # the axioms travel WITH the value
|
|
12
|
+
|
|
13
|
+
Why this and not a class hierarchy: a translation is NOT an upcast. It changes
|
|
14
|
+
the signature (the standard translation appends a world argument), it is only
|
|
15
|
+
defined on a fragment (``Until`` has no first-order form), and — the part a
|
|
16
|
+
subtype relation gets flatly wrong — the image usually does not answer a
|
|
17
|
+
validity question by itself. ``(∀x:Human M(x)) → ∃x:Human M(x)`` is valid in the
|
|
18
|
+
kit's many-sorted semantics, and its unsorted image is NOT valid: the sorts
|
|
19
|
+
being non-empty is a side condition, not part of the formula (so is a sorted
|
|
20
|
+
constant lying in its sort: ``∀x:Human M(x) → M(socrates:Human)`` has the same
|
|
21
|
+
trouble). So a converted
|
|
22
|
+
term is a term PLUS the axioms that make it mean what it meant, which is what
|
|
23
|
+
:class:`Sentence` holds together. Claiming ``modal ⊂ fol`` by inheritance would
|
|
24
|
+
license dropping exactly that, silently.
|
|
25
|
+
|
|
26
|
+
What each conversion preserves is the edge's ``guarantee`` (see
|
|
27
|
+
:data:`unicode_logic_kit.comorphism.GUARANTEES`) and it travels along:
|
|
28
|
+
:attr:`Sentence.guarantee` is the weakest on the path taken, and ``None`` means
|
|
29
|
+
some edge on it makes no promise.
|
|
30
|
+
|
|
31
|
+
There is deliberately NO implicit coercion: ``MODAL(f) & FOL(g)`` raises rather
|
|
32
|
+
than lifting one side, because the lift is where the side conditions would be
|
|
33
|
+
lost. Convert explicitly, then combine the terms.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
from dataclasses import dataclass, replace
|
|
37
|
+
from typing import Any, Optional, Tuple
|
|
38
|
+
|
|
39
|
+
from .comorphism import DEFAULT_REGISTRY, weakest_guarantee
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"Sentence", "Logic",
|
|
43
|
+
"FOL", "MSFOL", "MODAL", "QML", "ALC", "DRT", "TEAM", "ESO", "FUZZY",
|
|
44
|
+
"LOGICS",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass(frozen=True)
|
|
49
|
+
class Sentence:
|
|
50
|
+
"""A term, the logic it is written in, and the side conditions it carries.
|
|
51
|
+
|
|
52
|
+
``axioms`` are SEPARATE premises in the same logic as ``term`` — never
|
|
53
|
+
conjoined onto it (that is what makes a validity question answerable:
|
|
54
|
+
conjoining them would ask a prover to prove the axiom as well). ``path``
|
|
55
|
+
names the edges a conversion took, ``guarantee`` is the weakest one on that
|
|
56
|
+
path, and ``note`` collects the conventions those edges documented (free
|
|
57
|
+
anchors, fragment limits).
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
term: Any
|
|
61
|
+
logic: str
|
|
62
|
+
axioms: Tuple[Any, ...] = ()
|
|
63
|
+
guarantee: Optional[str] = "faithful"
|
|
64
|
+
path: Tuple[str, ...] = ()
|
|
65
|
+
note: str = ""
|
|
66
|
+
|
|
67
|
+
def __post_init__(self):
|
|
68
|
+
if isinstance(self.term, Sentence):
|
|
69
|
+
raise TypeError(
|
|
70
|
+
"Sentence: term is already a Sentence — pass its .term, or "
|
|
71
|
+
"convert with a logic value (e.g. FOL(sentence))")
|
|
72
|
+
object.__setattr__(self, "axioms", tuple(self.axioms))
|
|
73
|
+
object.__setattr__(self, "path", tuple(self.path))
|
|
74
|
+
|
|
75
|
+
def to(self, target: str, **options) -> "Sentence":
|
|
76
|
+
"""Convert into the logic labelled ``target`` through the registry.
|
|
77
|
+
|
|
78
|
+
``options`` are forwarded to the edges on the path that declare them
|
|
79
|
+
(e.g. ``frame=``/``systems=`` for the modal edge, ``signature=`` for the
|
|
80
|
+
sorted one); one that no edge on the path declares raises, so an option
|
|
81
|
+
can never be silently ignored into a different question. Side axioms
|
|
82
|
+
accumulate: those of this sentence are carried through the path as well,
|
|
83
|
+
because they are terms of its own logic.
|
|
84
|
+
"""
|
|
85
|
+
if target == self.logic:
|
|
86
|
+
return self
|
|
87
|
+
carried = DEFAULT_REGISTRY.translate(self.term, self.logic, target,
|
|
88
|
+
**options)
|
|
89
|
+
axioms = tuple(DEFAULT_REGISTRY.carry(a, self.logic, target, **options)
|
|
90
|
+
for a in self.axioms)
|
|
91
|
+
notes = "; ".join(n for n in (self.note, carried.note) if n)
|
|
92
|
+
return Sentence(
|
|
93
|
+
term=carried.result, logic=target,
|
|
94
|
+
axioms=axioms + carried.axioms,
|
|
95
|
+
guarantee=weakest_guarantee([self.guarantee, carried.guarantee]),
|
|
96
|
+
path=self.path + carried.path, note=notes)
|
|
97
|
+
|
|
98
|
+
def with_note(self, note: str) -> "Sentence":
|
|
99
|
+
"""A copy with ``note`` appended — conventions a caller wants kept."""
|
|
100
|
+
return replace(self, note="; ".join(n for n in (self.note, note) if n))
|
|
101
|
+
|
|
102
|
+
def _no_operators(self, operator: str) -> None:
|
|
103
|
+
raise TypeError(
|
|
104
|
+
f"Sentence: {operator} is not defined on a Sentence (this one is "
|
|
105
|
+
f"in logic {self.logic!r}). A Sentence is a term together with the "
|
|
106
|
+
"side axioms that make it mean what it meant; building a bigger "
|
|
107
|
+
"formula out of two of them is where those axioms get lost — "
|
|
108
|
+
"across logics silently and wrongly, within one logic by just "
|
|
109
|
+
"being dropped. Combine the .term values with the AST's own "
|
|
110
|
+
"constructors and pass the union of the .axioms as premises.")
|
|
111
|
+
|
|
112
|
+
def __and__(self, other): self._no_operators("'&'")
|
|
113
|
+
def __or__(self, other): self._no_operators("'|'")
|
|
114
|
+
def __invert__(self): self._no_operators("'~'")
|
|
115
|
+
|
|
116
|
+
def __repr__(self) -> str:
|
|
117
|
+
rendered = getattr(self.term, "to_unicode_str", None)
|
|
118
|
+
shown = rendered() if callable(rendered) else repr(self.term)
|
|
119
|
+
extra = f", {len(self.axioms)} axiom(s)" if self.axioms else ""
|
|
120
|
+
return (f"Sentence[{self.logic}]({shown}{extra}, "
|
|
121
|
+
f"guarantee={self.guarantee})")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@dataclass(frozen=True)
|
|
125
|
+
class Logic:
|
|
126
|
+
"""One logic in the graph, as a callable value.
|
|
127
|
+
|
|
128
|
+
``FOL(x)`` wraps a bare term written in classical FOL, and converts an ``x``
|
|
129
|
+
that is a :class:`Sentence` in another logic — the closest honest reading of
|
|
130
|
+
a cast: it either is already that logic, or there is a registered
|
|
131
|
+
translation and you get the term together with its side conditions.
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
label: str
|
|
135
|
+
description: str = ""
|
|
136
|
+
|
|
137
|
+
def __call__(self, term: Any, **options) -> Sentence:
|
|
138
|
+
if isinstance(term, Sentence):
|
|
139
|
+
return term.to(self.label, **options)
|
|
140
|
+
if options:
|
|
141
|
+
raise TypeError(
|
|
142
|
+
f"{self.label}: options {sorted(options)} apply to a "
|
|
143
|
+
f"CONVERSION; wrapping a bare term takes none")
|
|
144
|
+
return Sentence(term=term, logic=self.label)
|
|
145
|
+
|
|
146
|
+
def __str__(self) -> str:
|
|
147
|
+
return self.label
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
#: Classical first-order logic — what :func:`unicode_logic_kit.api.prove` decides.
|
|
151
|
+
FOL = Logic("fol", "classical first-order logic")
|
|
152
|
+
MSFOL = Logic("msfol", "many-sorted first-order logic (sorts are non-empty)")
|
|
153
|
+
MODAL = Logic("modal", "propositional modal / temporal / deontic / hybrid")
|
|
154
|
+
QML = Logic("qml", "quantified modal logic with a domain regime")
|
|
155
|
+
ALC = Logic("alc", "description-logic concepts")
|
|
156
|
+
DRT = Logic("drs", "discourse representation structures")
|
|
157
|
+
TEAM = Logic("team", "dependence / team-semantic sentences")
|
|
158
|
+
ESO = Logic("eso", "existential second-order logic")
|
|
159
|
+
FUZZY = Logic("fuzzy", "Łukasiewicz many-valued logic")
|
|
160
|
+
|
|
161
|
+
#: Every logic value by label — the labels :meth:`Sentence.to` accepts.
|
|
162
|
+
LOGICS = {logic.label: logic for logic in
|
|
163
|
+
(FOL, MSFOL, MODAL, QML, ALC, DRT, TEAM, ESO, FUZZY)}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""MCP server exposing the kit's seven-verb API, and more, as tools.
|
|
2
|
+
|
|
3
|
+
The Model Context Protocol (MCP) is the 2025/26 integration standard for
|
|
4
|
+
giving LLM agents typed tool access. This subpackage puts the kit's core
|
|
5
|
+
verbs (:mod:`unicode_logic_kit.api`) behind an MCP server so any MCP client —
|
|
6
|
+
Claude Code/Desktop, an agent framework, an editor — can parse, check,
|
|
7
|
+
prove, refute, diagnose, translate and verbalize formulas without writing a
|
|
8
|
+
line of Python. The repair loop inverts naturally: the kit deliberately
|
|
9
|
+
never rewrites formula text itself, and over MCP the CLIENT LLM is the
|
|
10
|
+
fixer — call ``diagnose``, apply the suggestion yourself, call again.
|
|
11
|
+
|
|
12
|
+
Optional dependency: ``pip install unicode-logic-kit[mcp]`` (the ``mcp``
|
|
13
|
+
Python SDK, >= 2.0). This subpackage is therefore NOT imported by
|
|
14
|
+
``unicode_logic_kit/__init__``; import it explicitly
|
|
15
|
+
(``from unicode_logic_kit.mcp import create_server``) or run the server with
|
|
16
|
+
``python -m unicode_logic_kit.mcp``.
|
|
17
|
+
|
|
18
|
+
Every tool takes TEXT (a formula in any supported dialect, auto-detected via
|
|
19
|
+
``api.parse_any``; a SMILES string for the chemistry tools; a concept in the
|
|
20
|
+
glyph or Manchester syntax for the ``dl_*`` tools) and returns the same
|
|
21
|
+
JSON-compatible dicts the Python API returns — nothing is invented at this
|
|
22
|
+
layer. The full tool list is in :mod:`unicode_logic_kit.mcp.server` and the MCP
|
|
23
|
+
guide.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
from .server import create_server, main
|
|
27
|
+
|
|
28
|
+
__all__ = ["create_server", "main"]
|