Move closure functions to separate module

This commit is contained in:
Patrick Lühne 2020-05-11 03:41:33 +02:00
parent 0011fd9d4c
commit 7c36c4b239
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 21 additions and 21 deletions

View File

@ -1,6 +1,8 @@
mod arithmetic_terms; mod arithmetic_terms;
mod closures;
pub(crate) use arithmetic_terms::*; pub(crate) use arithmetic_terms::*;
pub(crate) use closures::*;
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] #[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub(crate) enum OperatorNotation pub(crate) enum OperatorNotation
@ -105,26 +107,5 @@ pub(crate) struct ScopedFormula
pub formula: foliage::Formula, pub formula: foliage::Formula,
} }
// Move to separate utils file
pub(crate) fn existential_closure(scoped_formula: crate::ScopedFormula) -> foliage::Formula
{
match scoped_formula.free_variable_declarations.is_empty()
{
true => scoped_formula.formula,
false => foliage::Formula::exists(scoped_formula.free_variable_declarations,
Box::new(scoped_formula.formula)),
}
}
pub(crate) fn universal_closure(scoped_formula: crate::ScopedFormula) -> foliage::Formula
{
match scoped_formula.free_variable_declarations.is_empty()
{
true => scoped_formula.formula,
false => foliage::Formula::for_all(scoped_formula.free_variable_declarations,
Box::new(scoped_formula.formula)),
}
}
pub type InputConstantDeclarationDomains pub type InputConstantDeclarationDomains
= std::collections::BTreeMap<std::rc::Rc<foliage::FunctionDeclaration>, Domain>; = std::collections::BTreeMap<std::rc::Rc<foliage::FunctionDeclaration>, Domain>;

19
src/utils/closures.rs Normal file
View File

@ -0,0 +1,19 @@
pub(crate) fn existential_closure(scoped_formula: crate::ScopedFormula) -> foliage::Formula
{
match scoped_formula.free_variable_declarations.is_empty()
{
true => scoped_formula.formula,
false => foliage::Formula::exists(scoped_formula.free_variable_declarations,
Box::new(scoped_formula.formula)),
}
}
pub(crate) fn universal_closure(scoped_formula: crate::ScopedFormula) -> foliage::Formula
{
match scoped_formula.free_variable_declarations.is_empty()
{
true => scoped_formula.formula,
false => foliage::Formula::for_all(scoped_formula.free_variable_declarations,
Box::new(scoped_formula.formula)),
}
}