Skip to main content

A proof system for modal logic with cluster moderator architecture

Project description

EPICLogic — Library for Logical Deduction

Table of Contents


Installation

You can install EPICProver using pip:

pip install epicprover

Or, if you want the latest development version directly from GitHub:

pip install git+https://github.com/Fivochnik/Eberle-Protsenko-Intuitionistic-Constructive-Prover

Main Information

ProEbLogic provides tools for modal logic with custom operators, axioms, inference rules, and proof verification.

All string inputs (formulas, patterns, substitutions) are automatically parsed into opertree objects — the user never needs to work with trees directly.

Key modules:

  • operators — operator definitions (names, syntax, types, signatures)
  • opertree — internal representation of formulas
  • derivedFormula, inferenceRule, provenTheorem, proofTree, metatree — proof system

Module operators

Contains all operator configuration dictionaries.

Structure Description
OperatorNameList Ordered list of operator names
OperatorSyntax Symbolic notation
Operator name → numeric ID mapping
OperatorTypeNameList Formula type names
OperatorTypeName type name → numeric code
OperatorArgs Context-specific operator signatures {type_code: {op_id: (arg_types...)}}
PrefixOperators, InfixOperators, PostFixOperators Lists of operators of the specified fixity
OperatorFixity A dictionary storing the id of each operation and its fixity
NullaryOperatorHandler Parsing functions for nullary operators
OperatorDepth Temporal depth for fixed-point operators

The module is self-documenting: print(operators.__doc__) generates tables of current operators and their signatures.


Class opertree

Represents a formula as a tree node.

Constructor

opertree(type: int, value: list | object = None)

  • If value is None, type is interpreted as a string formula and parsed automatically.
  • Otherwise, type is a numeric operator ID, value is a list of children (for operators) or a raw value (for nullary operators).

Attributes

Attribute Type Description
type int Operator ID (from Operator dictionary)
value list[opertree] | object Children for operators, value for nullary

Methods

Method Description
isCorrectIn(formulaType) Checks if node arguments are correct for the given formula type
isCorrectAllIn(formulaType) Recursively checks the entire tree for type correctness
subs(params) In‑place replacement: parameters ($name) are replaced by trees from params dict
with_subs(params) Returns a new opertree with parameters replaced by the given substitutions. The original tree remains unchanged
paramValuesFor(other) Matches tree against other (which may contain parameters $name), returns dict of substitutions
copy() Returns a shallow copy (nullary values are shared)
__str__ String representation of the tree using OperatorSyntax and OperatorFixity
__repr__ Returns opertree(str(self))
__eq__, __ne__ Structural equality comparison

Parameters

  • Parameters are denoted by type == 'param' and value is the parameter name (e.g., 'A').
  • paramValuesFor returns a dictionary {param_name: opertree} or None if no match.

Example

pattern = opertree("$A & ($A -> $B)") — parsed from string
formula = opertree("p & (p -> q)") — also from string
subs = pattern.paramValuesFor(formula) — returns {'A': p, 'B': q}


Class derivedFormula

Represents a formula that is derivable under certain conditions.

Constructor

derivedFormula(tree: str | opertree, cond: dict[str, Callable | None] = {})

  • tree — pattern with optional parameters ($A, $B, ...)
  • cond — conditions on parameters:
    • None → parameter must be derivable
    • predicate function → parameter must satisfy it

String representation

(($A & $B) ← {$A, $B}) — formula derivable if $A and $B are derivable.


Class inferenceRule

Defines a rule of inference.

Constructor

inferenceRule(premise: list[opertree], conclusion: list[opertree])

  • premise — list of formulas representing the premise (meta-AND)
  • conclusion — list of formulas representing the conclusion (meta-AND)

Example: Modus Ponens

inferenceRule(
    premise = [opertree('$A'), opertree('$A -> $B')],
    conclusion = [opertree('$B')]
)
print(rule)

String representation

[$A, ($A -> $B)] → [$B]


Class provenTheorem

Represents a theorem proven by applying a rule with a substitution.

Constructor

provenTheorem(theorem: derivedFormula, rule: inferenceRule, subs: dict[str, str | opertree])

  • theorem — the proven formula (with conditions)
  • rule — inference rule used
  • subs — substitution mapping parameters to formulas

Properties

Property Description
isCorrect Whether theorem.tree matches rule.conclusion with subs applied
isDerivedIn(axioms) Whether the premise is derivable from the given axioms

String representation

(($A|$B) ← {$A}) from [$A, ($A->$B)] → [$B] with {A: $A, B: ($A|$B)}


Class proofTree

Represents a complete proof tree returned by isDerived.

Constructor

proofTree(target: opertree | provenTheorem, result: bool, reason: str, subproofs: list[proofTree])

Methods

Method Description
toStr(lasts=None, last=False, lvlType: int = 0) Returns visual proof tree with branches
toStrFull(lasts=None, last=False) Returns full visual proof tree with branches
__bool__ Returns result — success or failure
__str__ Returns self.toStr()

Output format (short mode)

Goal: (A|B) [✔]  ⊢ (A|B)
├─Theorem: ($A|$B) ← {$A} [✔]  (($A|$B) ∈ {($A|$B)}), ⊢ {$A, ($A->($A|$B))}
│ └─Goal: ($A&($A->($A|$B))) [✔]  ⊢ (($A&$B) ← {$A, $B})
│   ├─Goal: $A [✔]  [hyp]
│   └─Goal: ($A->($A|$B)) [✔]  ⊢ (($A->($A|$B)) ← {})
└─Goal: (A|B) [✔]  ⊢ (($A|$B) ← {$A})
  ├─Goal: A [✔]  ⊢ A
  └─Goal: B [✔]  [free]

Symbols

  • [✔] — success
  • [✘] — failure
  • [hyp] — assumption
  • [free] — free parameter (no proof required)
  • — "derivable from"
  • — "derivable from" (in theorems)
  • — "in set"
  • — "not in set"

Functions proven_theorems and isDerived

proven_theorems(theorems: list[provenTheorem], axioms: list[derivedFormula]) -> list[provenTheorem]

Filters the list of theorems, returning only those that can be proven from the given axioms (iteratively, respecting dependencies).

isDerived(main: str | opertree, axioms: list[derivedFormula], theorems: list[provenTheorem] = None) -> proofTree

Checks if main is derivable from axioms and true theorems from proven_theorems(theorems, axioms).

Returns a proofTree object representing the complete proof (or failure tree).


Function premise_subs

premise_subs(premise: list[opertree], hypothesis: list[opertree]) -> generator[dict[str, opertree]]

Finds all possible substitutions that make the list of premises match a list of hypotheses.

Example:

premise = [opertree('$A'), opertree('$A -> $B')]
hypothesis = [opertree('A'), opertree('B'), opertree('A -> C'), opertree('A -> D'), opertree('B -> D')]

for subs in premise_subs(premise, hypothesis):
    print(subs)

Output:

{'A': A, 'B': C}
{'A': A, 'B': D}
{'A': B, 'B': D}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epicprover-0.1.0.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epicprover-0.1.0-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file epicprover-0.1.0.tar.gz.

File metadata

  • Download URL: epicprover-0.1.0.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for epicprover-0.1.0.tar.gz
Algorithm Hash digest
SHA256 989311282e84cd4c9c51aca6139480bdba6f9159d22f0425682d203f6580db59
MD5 bae51f5454c05ade860d99846ca47093
BLAKE2b-256 af62ce4b834cc8677ca40b70cb8d8c6b025223353c6798e01b8fb330e8e8df3a

See more details on using hashes here.

File details

Details for the file epicprover-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: epicprover-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for epicprover-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5719f153049a5ac50be394d1674fecbaa5a819e82e829a04447e49c59acf53d1
MD5 89d9325254e23943e5db379d1eea7f54
BLAKE2b-256 45ac8d74acb0acb872ed30e486c06bd846a7dfd2510b7a4279cc25fdcd88f39e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page