Skip to main content

KripkeModel

Struct KripkeModel 

Source
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: usize

Number of worlds.

§num_vars: usize

Number 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

Source

pub fn reflexive(num_worlds: usize, num_vars: usize) -> Self

Create a Kripke model with reflexive accessibility (for T axiom).

Source

pub fn set_val(&mut self, world: usize, var: usize, truth: bool)

Set the valuation of variable var at world world.

Source

pub fn set_access(&mut self, from: usize, to: usize)

Set the accessibility from world from to world to.

Source

pub fn satisfies_at(&self, formula: &NnfFormula, world: usize) -> bool

Evaluate an NnfFormula at a given world (treating Box as necessity over accessible worlds).

Source

pub fn is_reflexive(&self) -> bool

Check if the model is reflexive (for T axiom validity).

Source

pub fn is_transitive(&self) -> bool

Check if the model is transitive (for S4 axiom validity).

Source

pub fn is_symmetric(&self) -> bool

Check if the model is symmetric (for B axiom validity).

Source

pub fn is_euclidean(&self) -> bool

Check if the model is Euclidean (for S5 axiom validity).

Source

pub fn accessible_count(&self, world: usize) -> usize

Number of worlds accessible from a given world.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.