Starting tracer
This commit is contained in:
@ -2,6 +2,7 @@ use std::fmt::Display;
|
||||
|
||||
use litemap::LiteMap;
|
||||
|
||||
use crate::ast::Body;
|
||||
use crate::ast::Predicate;
|
||||
use crate::ast::Variable;
|
||||
|
||||
@ -128,8 +129,7 @@ impl Predicate
|
||||
{
|
||||
if let Some(pred) = constraints.set.get(name)
|
||||
{
|
||||
let max_sub = pred.substitute(constraints);
|
||||
max_sub
|
||||
pred.substitute(constraints)
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -151,10 +151,23 @@ impl Predicate
|
||||
match self
|
||||
{
|
||||
Predicate::Variable(var_name) => name == var_name,
|
||||
Predicate::Fixed(_, predicates) => predicates
|
||||
.iter()
|
||||
.find(|x| x.contains_variable(name))
|
||||
.is_some(),
|
||||
Predicate::Fixed(_, predicates) => predicates.iter().any(|x| x.contains_variable(name)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Body
|
||||
{
|
||||
pub fn substitute(&self, constraints: &Constraints) -> Body
|
||||
{
|
||||
match self
|
||||
{
|
||||
Body::Term(predicate) => Body::Term(predicate.substitute(constraints)),
|
||||
Body::And(items) =>
|
||||
{
|
||||
Body::And(items.iter().map(|x| x.substitute(constraints)).collect())
|
||||
}
|
||||
Body::Or(items) => Body::Or(items.iter().map(|x| x.substitute(constraints)).collect()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user