Skip to content

Commit

Permalink
adding support for partially quantified lemmas
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachJHansen committed Aug 23, 2024
1 parent 8ffcfb6 commit 3bb705b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/simplifying/fol/ht.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fn remove_idempotences(formula: Formula) -> Formula {
}
}

fn join_nested_quantifiers(formula: Formula) -> Formula {
pub(crate) fn join_nested_quantifiers(formula: Formula) -> Formula {
// Remove nested quantifiers
// e.g. q X ( q Y F(X,Y) ) => q X Y F(X,Y)

Expand Down
14 changes: 14 additions & 0 deletions src/syntax_tree/fol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use {
TheoryParser, UnaryConnectiveParser, UnaryOperatorParser, UserGuideEntryParser,
UserGuideParser, VariableParser,
},
simplifying::fol::ht::join_nested_quantifiers,
syntax_tree::{impl_node, Node},
verifying::problem,
},
Expand Down Expand Up @@ -819,6 +820,10 @@ impl Formula {
self.quantify(Quantifier::Forall, variables)
}

pub fn universal_closure_with_quantifier_joining(self) -> Formula {
join_nested_quantifiers(self.universal_closure())
}

pub fn rename_conflicting_symbols(self, possible_conflicts: &IndexSet<Predicate>) -> Formula {
match self {
Formula::AtomicFormula(a) => {
Expand Down Expand Up @@ -944,6 +949,15 @@ impl AnnotatedFormula {
}
}

pub fn universal_closure_with_quantifier_joining(&self) -> Self {
AnnotatedFormula {
role: self.role,
direction: self.direction,
name: self.name.clone(),
formula: self.formula.clone().universal_closure_with_quantifier_joining(),
}
}

pub fn replace_placeholders(mut self, mapping: &IndexMap<String, FunctionConstant>) -> Self {
self.formula = self.formula.replace_placeholders(mapping);
self
Expand Down
2 changes: 1 addition & 1 deletion src/verifying/outline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl ProofOutline {
match anf.role {
fol::Role::Lemma | fol::Role::InductiveLemma => {
let general_lemma: GeneralLemma = anf
.universal_closure()
.universal_closure_with_quantifier_joining()
.replace_placeholders(placeholders)
.try_into()?;
match anf.direction {
Expand Down

0 comments on commit 3bb705b

Please sign in to comment.