pub enum Algebra {
Kleene,
Lukasiewicz,
Bochvar,
}Expand description
三值逻辑的语义体系。
Variants§
Kleene
Kleene 强三值逻辑:X 表示“不知道”,运算在不确定时产出 X。
Lukasiewicz
Łukasiewicz 三值模糊逻辑:X 是 0 与 1 之间的不确定值。
Bochvar
Bochvar 弱三值逻辑:X 是“毒值”,沾上 X 即为 X。
Implementations§
Source§impl Algebra
impl Algebra
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
解析语义名称,接受 kleene / k3、lukasiewicz / l3 / luk / bochvar / b3。
Sourcepub const fn is_poisonous(self) -> bool
pub const fn is_poisonous(self) -> bool
该语义下 X 是否是吸收元(Bochvar 毒值语义)。
Sourcepub const fn and(self, a: Ternary, b: Ternary) -> Ternary
pub const fn and(self, a: Ternary, b: Ternary) -> Ternary
逻辑与 ∧。
K3 / Ł3:格序 min(X 是中间元)。B3:X 吸收。
Sourcepub const fn or(self, a: Ternary, b: Ternary) -> Ternary
pub const fn or(self, a: Ternary, b: Ternary) -> Ternary
逻辑或 ∨。
K3 / Ł3:格序 max(X 是中间元)。B3:X 吸收。
Sourcepub const fn strong_add(self, a: Ternary, b: Ternary) -> Ternary
pub const fn strong_add(self, a: Ternary, b: Ternary) -> Ternary
强加法 ⊕。
- Łukasiewicz:
min(1, a + b),X ⊕ X = 1。 - Kleene:
0/1上为max(0, a + b - 1),X传播为X。 - Bochvar:
X是毒值,沾上即X。
Sourcepub const fn strong_and(self, a: Ternary, b: Ternary) -> Ternary
pub const fn strong_and(self, a: Ternary, b: Ternary) -> Ternary
强合取 ⊗。
- Łukasiewicz:
max(0, a + b - 1),X ⊗ X = 0。 - Kleene / Bochvar:
X传播为X。
Trait Implementations§
impl Copy for Algebra
Source§impl<'de> Deserialize<'de> for Algebra
impl<'de> Deserialize<'de> for Algebra
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Algebra
impl StructuralPartialEq for Algebra
Auto Trait Implementations§
impl Freeze for Algebra
impl RefUnwindSafe for Algebra
impl Send for Algebra
impl Sync for Algebra
impl Unpin for Algebra
impl UnsafeUnpin for Algebra
impl UnwindSafe for Algebra
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more