pub struct KripkeModel {
pub num_worlds: usize,
pub num_vars: usize,
pub access: Vec<Vec<bool>>,
pub val: Vec<Vec<bool>>,
}Expand description
A Kripke model for modal propositional logic.
A Kripke model M = (W, R, V) consists of:
- W: a set of worlds (indexed 0..n)
- R: an accessibility relation (as adjacency matrix)
- V: a valuation assigning truth values to atoms at each world
Fields§
§num_worlds: usizeNumber of worlds.
num_vars: usizeNumber of propositional variables.
access: Vec<Vec<bool>>Accessibility relation: access[i][j] = world i can see world j.
val: Vec<Vec<bool>>Valuation: val[w][p] = atom p is true at world w.
Implementations§
Source§impl KripkeModel
impl KripkeModel
Sourcepub fn reflexive(num_worlds: usize, num_vars: usize) -> Self
pub fn reflexive(num_worlds: usize, num_vars: usize) -> Self
Create a Kripke model with reflexive accessibility (for T axiom).
Sourcepub fn set_val(&mut self, world: usize, var: usize, truth: bool)
pub fn set_val(&mut self, world: usize, var: usize, truth: bool)
Set the valuation of variable var at world world.
Sourcepub fn set_access(&mut self, from: usize, to: usize)
pub fn set_access(&mut self, from: usize, to: usize)
Set the accessibility from world from to world to.
Sourcepub fn satisfies_at(&self, formula: &NnfFormula, world: usize) -> bool
pub fn satisfies_at(&self, formula: &NnfFormula, world: usize) -> bool
Evaluate an NnfFormula at a given world (treating Box as necessity over accessible worlds).
Sourcepub fn is_reflexive(&self) -> bool
pub fn is_reflexive(&self) -> bool
Check if the model is reflexive (for T axiom validity).
Sourcepub fn is_transitive(&self) -> bool
pub fn is_transitive(&self) -> bool
Check if the model is transitive (for S4 axiom validity).
Sourcepub fn is_symmetric(&self) -> bool
pub fn is_symmetric(&self) -> bool
Check if the model is symmetric (for B axiom validity).
Sourcepub fn is_euclidean(&self) -> bool
pub fn is_euclidean(&self) -> bool
Check if the model is Euclidean (for S5 axiom validity).
Sourcepub fn accessible_count(&self, world: usize) -> usize
pub fn accessible_count(&self, world: usize) -> usize
Number of worlds accessible from a given world.