clingo-hmknf-test/ontology.py

21 lines
470 B
Python
Raw Normal View History

2022-06-25 18:57:56 -06:00
from typing import Set
models = (
{"a", "b", "c"},
)
DL_ATOMS = set.union(*models)
def propagate(atoms: Set[str]) -> Set[str]:
atoms = atoms.intersection(DL_ATOMS)
sub_models = (model for model in models if atoms <= model)
first: set = next(sub_models, None)
if first is None:
return set()
return first.intersection(*sub_models)
def check(atoms: Set[str]) -> bool:
atoms = atoms.intersection(DL_ATOMS)
return atoms in models
2022-06-27 17:26:35 -06:00