From e408732902fcbb7215006294f49d69969b111597 Mon Sep 17 00:00:00 2001 From: ZachJHansen Date: Wed, 29 Nov 2023 11:37:12 -0600 Subject: [PATCH] Fixing the n>1 bug by re-ordering atom and comparison within the fol grammar --- src/parsing/fol/grammar.pest | 2 +- src/parsing/fol/pest.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/parsing/fol/grammar.pest b/src/parsing/fol/grammar.pest index 0c2d9bc2..09416c29 100644 --- a/src/parsing/fol/grammar.pest +++ b/src/parsing/fol/grammar.pest @@ -68,7 +68,7 @@ relation = { greater_equal | less_equal | greater | less | not_equal | equal } guard = { relation ~ general_term } -atomic_formula = { truth | falsity | atom | comparison } +atomic_formula = { truth | falsity | comparison | atom } truth = { "#true" } falsity = { "#false" } comparison = { general_term ~ guard+ } diff --git a/src/parsing/fol/pest.rs b/src/parsing/fol/pest.rs index 57d8c501..232e219a 100644 --- a/src/parsing/fol/pest.rs +++ b/src/parsing/fol/pest.rs @@ -885,6 +885,18 @@ mod tests { }], }), ), + ( + "n > 1", + AtomicFormula::Comparison(Comparison { + term: GeneralTerm::Symbol("n".to_string()), + guards: vec![Guard { + relation: Relation::Greater, + term: GeneralTerm::IntegerTerm(IntegerTerm::BasicIntegerTerm( + BasicIntegerTerm::Numeral(1), + )), + }], + }), + ), ( "1 <= N$g > 3 < X$i", AtomicFormula::Comparison(Comparison {