Metadata-Version: 2.1
Name: smcplaus
Version: 1.0.0
Summary: A symbolic model checker for the single-agent plausibility models of dynamic epistemic logic
Home-page: https://github.com/python-poetry/poetry
License: MIT
Keywords: belief revision,dynamic epistemic logic,logic,plausibility,symbolic model checking
Author: David Alvarez Lombardi
Author-email: dqalombardi@proton.me
Maintainer: David Alvarez Lombardi
Maintainer-email: dqalombardi@proton.me
Requires-Python: >=3.11,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Project-URL: Repository, https://github.com/python-poetry/poetry
Description-Content-Type: text/markdown

# smcplaus

Project repository: [https://gitlab.com/dqalombardi/smcplaus](https://gitlab.com/dqalombardi/smcplaus)

Project owner: [David Alvarez Lombardi](https://linktr.ee/dqalombardi)

## Description

A symbolic model checker for the single-agent plausibility models of [dynamic epistemic logic](https://plato.stanford.edu/entries/dynamic-epistemic/).

## References

- [SEP: *Plausibility models and belief change* (Baltag & Renne 2016)](https://plato.stanford.edu/entries/dynamic-epistemic/#PlauModeBeliChan)
- [*A qualitative theory of dynamic interactive belief revision* (Baltag & Smets 2008)](https://doi.org/10.1007/978-3-319-20451-2_39)
- [*Dynamic logic for belief revision* (van Benthem 2007)](https://doi.org/10.3166/jancl.17.129-155)
- [*Dynamic interactive epistemology* (Board 2004)](https://doi.org/10.1016/j.geb.2003.10.006)
- [*Two modellings for theory change* (Grove 1988)](https://doi.org/10.1007/BF00247909)

## Usage

### Specifying formulas

Specify propositional variables.
```python
p = PropositionalVariable(letter="p")
q0 = PropositionalVariable(letter="q", index=0)
q1 = PropositionalVariable(letter="q", index=1)
```

Specify complex formulas.

```python
form_p = Formula(node=p, subformulas=None)
form_q0 = Formula(node=q0, subformulas=None)
form0 = Formula(node=Connectives.DIAMOND, subformulas=(form_q0,))  # <>q0
form1 = Formula(node=Connectives.RADICAL_UPGRADE, subformulas=(form_q0, form0))  # [$q0]<>q0
```

### Specifying models

Specify plausibility frames by specifying a domain and a state-to-appearance map.

```python
state0 = State(index=0)
state1 = State(index=1)
state2 = State(index=2)

my_frame = PlausibilityFrame(
    domain={state0, state1, state2},
    state_to_appearance={
        state0: {state1},
        state1: {state2},
        state2: {state2},
    },
    force_s4=True,
)
```


Specify plausibility models by specifying a frame and a state-to-facts map.

```python
my_model = PlausibilityModel(
    frame=my_frame,
    state_to_facts={
        state0: {p, q0},
        state1: {q1},
        state2: {p, q1},
    },
)
```


Specify pointed plausibility models by specifying a model and a point.

```python
my_pointed_model = PointedPlausibilityModel(
    model=my_model,
    point=state1,
)
```

### Checking (pointed) models against formulas

Check if a pointed model satisfies a formula.

```python
my_pointed_model_satisfies_form0 = my_pointed_model.satisfies(form0)  # False
my_pointed_model_satisfies_form1 = my_pointed_model.satisfies(form1)  # True
```

Check where a model satisfies a formula.

```python
form_p_truthset = my_model.truthset(form_p)  # {State(s2), State(s0)}
```

### Modifying models with formulas

Upgrade a model with a formula.

```python
my_new_model = my_model.radical_upgrade(form_q0)
```

### Loading and dumping models with JSON files

Specify and load a structure from a JSON file.

```python
my_other_model_json_str = """
{
    "frame": {
        "domain": ["s0", "s1", "s2"],
        "state_to_appearance": {
            "s0": ["s1"],
            "s1": ["s2"],
            "s2": ["s2"]
        }
    },
    "state_to_facts": {
        "s0": ["p", "q0"],
        "s1": ["q1"],
        "s2": ["p", "q1"]
    }
}
"""

my_other_model = PlausibilityModel.from_json(my_other_model_json_str, force_s4=True)
```

Dump a structure to a JSON file.

```python
output_json = my_other_model.to_json()
```

See `./examples/` for further example usage.

## Contributing

Before submitting a merge request, run the command `tox`, which will run formatters, linters, static type-checkers, and unit tests respectively.

