Domains test

This commit is contained in:
2026-02-12 20:59:45 +01:00
parent 27af8c9263
commit 5458b3a822
9 changed files with 783 additions and 56 deletions

View File

@ -2,6 +2,8 @@ use owo_colors::{OwoColorize, colors::css::Gray};
use std::fmt::Display;
use crate::domain::Domain;
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub struct Variable(pub String, pub Option<usize>);
@ -31,6 +33,7 @@ pub enum Predicate
{
Variable(Variable), // Upercase variable like X
Fixed(Functor, Vec<Predicate>),
Domain(Domain),
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
@ -135,6 +138,7 @@ impl Display for Predicate
Ok(())
}
}
Predicate::Domain(domain) => write!(f, "{domain}"),
}
}
}
@ -174,6 +178,7 @@ impl Display for Functor
}
}
}
impl Display for Operator
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result