diff --git a/src/syntax_tree/fol.rs b/src/syntax_tree/fol.rs index d1590d65..ddaef468 100644 --- a/src/syntax_tree/fol.rs +++ b/src/syntax_tree/fol.rs @@ -963,12 +963,8 @@ impl_node!(AnnotatedFormula, Format, AnnotatedFormulaParser); impl AnnotatedFormula { pub fn into_problem_formula(self, role: problem::Role) -> problem::AnnotatedFormula { problem::AnnotatedFormula { - name: if self.name.is_empty() { - // TODO: Revisit default naming scheme! - self.role.to_string() - } else { - self.name - }, + // TODO: Revisit default naming scheme! + name: self.name, role, formula: self.formula, } diff --git a/src/verifying/problem/mod.rs b/src/verifying/problem/mod.rs index 8b60c878..d81dc539 100644 --- a/src/verifying/problem/mod.rs +++ b/src/verifying/problem/mod.rs @@ -136,6 +136,20 @@ impl Problem { self } + // TODO: Improve naming scheme for formulas + pub fn create_unique_formula_names(mut self) -> Self { + let mut formulas = vec![]; + for (i, f) in self.formulas.into_iter().enumerate() { + formulas.push(AnnotatedFormula { + name: format!("formula_{i}_{}", f.name), + role: f.role, + formula: f.formula, + }); + } + self.formulas = formulas; + self + } + pub fn axioms(&self) -> Vec { self.formulas .iter() diff --git a/src/verifying/task/external_equivalence.rs b/src/verifying/task/external_equivalence.rs index c6ba07b4..bf7183a8 100644 --- a/src/verifying/task/external_equivalence.rs +++ b/src/verifying/task/external_equivalence.rs @@ -704,7 +704,8 @@ impl Task for AssembledExternalEquivalenceTask { Problem::with_name(format!("forward_outline_{i}_{j}")) .add_annotated_formulas(axioms.clone()) .add_annotated_formulas(std::iter::once(conjecture.clone())) - .rename_conflicting_symbols(), + .rename_conflicting_symbols() + .create_unique_formula_names(), ); } axioms.append(&mut lemma.consequences.clone()); @@ -722,6 +723,7 @@ impl Task for AssembledExternalEquivalenceTask { ) .add_annotated_formulas(self.forward_conclusions) .rename_conflicting_symbols() + .create_unique_formula_names() .decompose(self.decomposition), ); } @@ -745,7 +747,8 @@ impl Task for AssembledExternalEquivalenceTask { Problem::with_name(format!("backward_outline_{i}_{j}")) .add_annotated_formulas(axioms.clone()) .add_annotated_formulas(std::iter::once(conjecture.clone())) - .rename_conflicting_symbols(), + .rename_conflicting_symbols() + .create_unique_formula_names(), ); } axioms.append(&mut lemma.consequences.clone()); @@ -763,6 +766,7 @@ impl Task for AssembledExternalEquivalenceTask { ) .add_annotated_formulas(self.backward_conclusions) .rename_conflicting_symbols() + .create_unique_formula_names() .decompose(self.decomposition), ); } diff --git a/src/verifying/task/strong_equivalence.rs b/src/verifying/task/strong_equivalence.rs index 363b4d39..f3b5c00c 100644 --- a/src/verifying/task/strong_equivalence.rs +++ b/src/verifying/task/strong_equivalence.rs @@ -105,7 +105,8 @@ impl Task for StrongEquivalenceTask { role: Role::Conjecture, formula, }) - .rename_conflicting_symbols(), + .rename_conflicting_symbols() + .create_unique_formula_names(), ); } if matches!( @@ -129,7 +130,8 @@ impl Task for StrongEquivalenceTask { role: Role::Conjecture, formula, }) - .rename_conflicting_symbols(), + .rename_conflicting_symbols() + .create_unique_formula_names(), ); }