Move closure functions to separate module
This commit is contained in:
parent
0011fd9d4c
commit
7c36c4b239
23
src/utils.rs
23
src/utils.rs
@ -1,6 +1,8 @@
|
||||
mod arithmetic_terms;
|
||||
mod closures;
|
||||
|
||||
pub(crate) use arithmetic_terms::*;
|
||||
pub(crate) use closures::*;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||
pub(crate) enum OperatorNotation
|
||||
@ -105,26 +107,5 @@ pub(crate) struct ScopedFormula
|
||||
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
|
||||
= std::collections::BTreeMap<std::rc::Rc<foliage::FunctionDeclaration>, Domain>;
|
||||
|
19
src/utils/closures.rs
Normal file
19
src/utils/closures.rs
Normal 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)),
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user