From 7c36c4b239ee251ac7bc3058c0839ee4916546c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Mon, 11 May 2020 03:41:33 +0200 Subject: [PATCH] Move closure functions to separate module --- src/utils.rs | 23 ++--------------------- src/utils/closures.rs | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 src/utils/closures.rs diff --git a/src/utils.rs b/src/utils.rs index 7ef9c9f..48f07b5 100644 --- a/src/utils.rs +++ b/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, Domain>; diff --git a/src/utils/closures.rs b/src/utils/closures.rs new file mode 100644 index 0000000..c8e67ee --- /dev/null +++ b/src/utils/closures.rs @@ -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)), + } +}