use crate::formula::*;
use crate::parser::Match;
use crate::prop::*;
use crate::symbol::{Atom, Symbolic};
use enum_iterator::Sequence;
#[derive(Sequence, PartialEq, Eq, Ord, PartialOrd, Copy, Clone, Default, Hash)]
enum ModalUnary {
Box,
Diamond,
#[default]
Not,
}
impl std::fmt::Display for ModalUnary {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
ModalUnary::Box => write!(f, "◻"),
ModalUnary::Diamond => write!(f, "◊"),
ModalUnary::Not => write!(f, "¬"),
}
}
}
impl Symbolic for ModalUnary {}
impl Match for ModalUnary {
fn match_str(s: &str) -> Option<Self> {
match s {
"◻" => Some(ModalUnary::Box),
"◊" => Some(ModalUnary::Diamond),
"¬" | "not" | "~" => Some(ModalUnary::Not),
_ => None,
}
}
fn get_matches(&self) -> Vec<String> {
match self {
ModalUnary::Box => vec!["◻".to_owned()],
ModalUnary::Diamond => vec!["◊".to_owned()],
ModalUnary::Not => vec!["¬".to_owned(), "not".to_owned(), "~".to_owned()],
}
}
}
type ModalBinary = PropBinary;
type ModalFormula = Formula<ModalBinary, ModalUnary, Atom>;