Remove incorrect check
This commit is contained in:
parent
b80b3bf6d6
commit
c3b149a473
17
src/error.rs
17
src/error.rs
@ -26,8 +26,6 @@ pub enum Kind
|
|||||||
VariableNameNotAllowed(String),
|
VariableNameNotAllowed(String),
|
||||||
FormulaNotClosed(std::rc::Rc<crate::VariableDeclarations>),
|
FormulaNotClosed(std::rc::Rc<crate::VariableDeclarations>),
|
||||||
PrivatePredicateCycle(std::rc::Rc<crate::PredicateDeclaration>),
|
PrivatePredicateCycle(std::rc::Rc<crate::PredicateDeclaration>),
|
||||||
PrivatePredicateDependingOnPublicPredicate(std::rc::Rc<crate::PredicateDeclaration>,
|
|
||||||
std::rc::Rc<crate::PredicateDeclaration>),
|
|
||||||
RunVampire,
|
RunVampire,
|
||||||
// TODO: rename to something Vampire-specific
|
// TODO: rename to something Vampire-specific
|
||||||
ProveProgram(Option<i32>, String, String),
|
ProveProgram(Option<i32>, String, String),
|
||||||
@ -166,15 +164,6 @@ impl Error
|
|||||||
Self::new(Kind::PrivatePredicateCycle(predicate_declaration))
|
Self::new(Kind::PrivatePredicateCycle(predicate_declaration))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn new_private_predicate_depending_on_public_predicate(
|
|
||||||
private_predicate_declaration: std::rc::Rc<crate::PredicateDeclaration>,
|
|
||||||
public_predicate_declaration: std::rc::Rc<crate::PredicateDeclaration>)
|
|
||||||
-> Self
|
|
||||||
{
|
|
||||||
Self::new(Kind::PrivatePredicateDependingOnPublicPredicate(private_predicate_declaration,
|
|
||||||
public_predicate_declaration))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn new_run_vampire<S: Into<Source>>(source: S) -> Self
|
pub(crate) fn new_run_vampire<S: Into<Source>>(source: S) -> Self
|
||||||
{
|
{
|
||||||
Self::new(Kind::RunVampire).with(source)
|
Self::new(Kind::RunVampire).with(source)
|
||||||
@ -255,12 +244,6 @@ impl std::fmt::Debug for Error
|
|||||||
write!(formatter,
|
write!(formatter,
|
||||||
"program is not supertight (private predicate {} transitively depends on itself)",
|
"program is not supertight (private predicate {} transitively depends on itself)",
|
||||||
predicate_declaration.declaration),
|
predicate_declaration.declaration),
|
||||||
Kind::PrivatePredicateDependingOnPublicPredicate(ref private_predicate_declaration,
|
|
||||||
ref public_predicate_declaration) =>
|
|
||||||
write!(formatter,
|
|
||||||
"private predicate {} transitively depends on public predicate {}",
|
|
||||||
private_predicate_declaration.declaration,
|
|
||||||
public_predicate_declaration.declaration),
|
|
||||||
Kind::RunVampire => write!(formatter, "could not run Vampire"),
|
Kind::RunVampire => write!(formatter, "could not run Vampire"),
|
||||||
Kind::ProveProgram(exit_code, ref stdout, ref stderr) =>
|
Kind::ProveProgram(exit_code, ref stdout, ref stderr) =>
|
||||||
{
|
{
|
||||||
|
@ -52,15 +52,7 @@ impl Problem
|
|||||||
pub(crate) fn check_consistency(&self, proof_direction: ProofDirection)
|
pub(crate) fn check_consistency(&self, proof_direction: ProofDirection)
|
||||||
-> Result<(), crate::Error>
|
-> Result<(), crate::Error>
|
||||||
{
|
{
|
||||||
let predicate_declarations = self.predicate_declarations.borrow();
|
for predicate_declaration in self.predicate_declarations.borrow().iter()
|
||||||
let statements = self.statements.borrow();
|
|
||||||
let completed_definitions = match statements.get(&SectionKind::CompletedDefinitions)
|
|
||||||
{
|
|
||||||
Some(completed_definitions) => completed_definitions,
|
|
||||||
None => return Ok(()),
|
|
||||||
};
|
|
||||||
|
|
||||||
for predicate_declaration in predicate_declarations.iter()
|
|
||||||
{
|
{
|
||||||
if predicate_declaration.is_built_in()
|
if predicate_declaration.is_built_in()
|
||||||
{
|
{
|
||||||
@ -74,32 +66,6 @@ impl Problem
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let matching_statement = |statement: &&Statement|
|
|
||||||
match statement.kind
|
|
||||||
{
|
|
||||||
StatementKind::CompletedDefinition(ref other_predicate_declaration) =>
|
|
||||||
predicate_declaration == &*other_predicate_declaration,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
let completed_definition = &completed_definitions.iter()
|
|
||||||
.find(matching_statement)
|
|
||||||
.expect("all predicates should have completed definitions at this point")
|
|
||||||
.formula;
|
|
||||||
|
|
||||||
let dependencies = crate::collect_predicate_declarations(&completed_definition);
|
|
||||||
|
|
||||||
for dependency in dependencies
|
|
||||||
{
|
|
||||||
if !predicate_declaration.is_public() && dependency.is_public()
|
|
||||||
{
|
|
||||||
return Err(
|
|
||||||
crate::Error::new_private_predicate_depending_on_public_predicate(
|
|
||||||
std::rc::Rc::clone(&predicate_declaration),
|
|
||||||
std::rc::Rc::clone(&dependency)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If a backward proof is necessary, the program needs to be supertight, that is, no
|
// If a backward proof is necessary, the program needs to be supertight, that is, no
|
||||||
// private predicates may transitively depend on themselves
|
// private predicates may transitively depend on themselves
|
||||||
if proof_direction.requires_backward_proof() && !predicate_declaration.is_public()
|
if proof_direction.requires_backward_proof() && !predicate_declaration.is_public()
|
||||||
|
Loading…
Reference in New Issue
Block a user