Rename “assert” statement to “spec”

This commit is contained in:
Patrick Lühne 2020-05-22 18:34:59 +02:00
parent 116f74f63e
commit 739cae1f7c
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
9 changed files with 26 additions and 23 deletions

View File

@ -1,3 +1,3 @@
input: p/2.
assert: exists X, Y p(X, Y) <-> exists X q(X).
spec: exists X, Y p(X, Y) <-> exists X q(X).

View File

@ -1,6 +1,6 @@
input: p/1.
assert:
spec:
forall N
(
forall X (p(X) -> exists I exists M (I = M and I = X and I <= N))

View File

@ -10,7 +10,7 @@ axiom: forall N1, N2, N3 (N1 > N2 and N3 > 0 -> N1 * N3 > N2 * N3).
# This axiom is necessary because we use Vampire without higher-order reasoning
axiom: (p(0) and forall N (N >= 0 and p(N) -> p(N + 1))) -> (forall N p(N)).
assert: exists N (forall X (q(X) <-> X = N) and N >= 0 and N * N <= n and (N + 1) * (N + 1) > n).
spec: exists N (forall X (q(X) <-> X = N) and N >= 0 and N * N <= n and (N + 1) * (N + 1) > n).

View File

@ -18,8 +18,8 @@ output: in/1.
assume: forall X, Y (s(X, Y) -> is_int(Y)).
# Only valid sets can be included in the solution
assert: forall X (in(X) -> X >= 1 and X <= n).
spec: forall X (in(X) -> X >= 1 and X <= n).
# If an element is contained in an input set, it must be covered by all solutions
assert: forall X (exists I s(X, I) -> exists I (in(I) and s(X, I))).
spec: forall X (exists I s(X, I) -> exists I (in(I) and s(X, I))).
# Elements may not be covered by two input sets
assert: forall I, J (exists X (s(X, I) and s(X, J)) and in(I) and in(J) -> I = J).
spec: forall I, J (exists X (s(X, I) and s(X, J)) and in(I) and in(J) -> I = J).

View File

@ -13,7 +13,7 @@ lemma(backward): forall N (composite(N) -> (exists N10 (1 <= N and N <= n and 2
lemma: forall X1 (composite(X1) <-> (exists N1, N10 (X1 = N1 and 1 <= N1 and N1 <= n and 2 <= N10 and N10 <= N1 - 1 and exists N11 (N1 = (N10 * N11) and 0 < N11)))).
assert: forall X (composite(X) -> p__is_integer__(X)).
assert: forall N (composite(N) <-> N > 1 and N <= n and exists I, J (I > 1 and J > 1 and I * J = N)).
assert: forall X (prime(X) -> p__is_integer__(X)).
assert: forall N (prime(N) <-> N > 1 and N <= n and not exists I, J (I > 1 and J > 1 and I * J = N)).
#spec: forall X (composite(X) -> p__is_integer__(X)).
#spec: forall N (composite(N) <-> N > 1 and N <= n and exists I, J (I > 1 and J > 1 and I * J = N)).
spec: forall X (prime(X) -> p__is_integer__(X)).
spec: forall N (prime(N) <-> N > 1 and N <= n and not exists I, J (I > 1 and J > 1 and I * J = N)).

View File

@ -364,16 +364,16 @@ pub(crate) fn parse_specification(mut input: &str, problem: &crate::Problem)
continue;
},
"assert" =>
"spec" =>
{
let (formula, remaining_input) = formula_statement_body(input, problem)?;
input = remaining_input;
let statement = crate::problem::Statement::new(
crate::problem::StatementKind::Assertion, formula);
crate::problem::StatementKind::Spec, formula);
problem.add_statement(crate::problem::SectionKind::Assertions, statement);
problem.add_statement(crate::problem::SectionKind::Specs, statement);
continue;
},

View File

@ -190,7 +190,8 @@ impl Problem
{
self.print_step_title("Started",
termcolor::ColorSpec::new().set_bold(true).set_fg(Some(termcolor::Color::Green)))?;
self.shell.borrow_mut().println(&"verification of assertions from translated program",
self.shell.borrow_mut().println(
&"verification of specification from translated program",
&termcolor::ColorSpec::new())?;
let mut statements = self.statements.borrow_mut();
@ -229,7 +230,7 @@ impl Problem
};
self.print_step_title("Finished", &step_title_color)?;
println!("verification of assertions from translated program");
println!("verification of specification from translated program");
}
if proof_direction == ProofDirection::Both
@ -242,7 +243,8 @@ impl Problem
{
self.print_step_title("Started",
termcolor::ColorSpec::new().set_bold(true).set_fg(Some(termcolor::Color::Green)))?;
self.shell.borrow_mut().println(&"verification of translated program from assertions",
self.shell.borrow_mut().println(
&"verification of translated program from specification",
&termcolor::ColorSpec::new())?;
let mut statements = self.statements.borrow_mut();
@ -256,7 +258,7 @@ impl Problem
{
StatementKind::Axiom
| StatementKind::Assumption
| StatementKind::Assertion =>
| StatementKind::Spec =>
statement.proof_status = ProofStatus::AssumedProven,
StatementKind::Lemma(ProofDirection::Forward) =>
statement.proof_status = ProofStatus::Ignored,
@ -280,7 +282,7 @@ impl Problem
};
self.print_step_title("Finished", &step_title_color)?;
println!("verification of translated program from assertions");
println!("verification of translated program from specification");
}
Ok(())
@ -537,6 +539,7 @@ impl<'p> std::fmt::Display for ProblemTPTPDisplay<'p>
continue;
}
// TODO: refactor
let title = match section_kind
{
SectionKind::CompletedDefinitions => "completed definitions",
@ -544,7 +547,7 @@ impl<'p> std::fmt::Display for ProblemTPTPDisplay<'p>
SectionKind::Axioms => "axioms",
SectionKind::Assumptions => "assumptions",
SectionKind::Lemmas => "lemmas",
SectionKind::Assertions => "assertions",
SectionKind::Specs => "specs",
};
write_title(formatter, title, section_separator)?;

View File

@ -7,7 +7,7 @@ pub enum SectionKind
Lemmas,
CompletedDefinitions,
IntegrityConstraints,
Assertions,
Specs,
}
impl std::fmt::Debug for SectionKind
@ -21,7 +21,7 @@ impl std::fmt::Debug for SectionKind
Self::Axioms => write!(formatter, "axiom"),
Self::Assumptions => write!(formatter, "assumption"),
Self::Lemmas => write!(formatter, "lemma"),
Self::Assertions => write!(formatter, "assertion"),
Self::Specs => write!(formatter, "spec"),
}
}
}

View File

@ -8,7 +8,7 @@ pub(crate) enum StatementKind
CompletedDefinition(std::rc::Rc<crate::PredicateDeclaration>),
IntegrityConstraint,
Lemma(ProofDirection),
Assertion,
Spec,
}
impl std::fmt::Debug for StatementKind
@ -23,7 +23,7 @@ impl std::fmt::Debug for StatementKind
write!(formatter, "completed definition of {}", predicate_declaration.declaration),
Self::IntegrityConstraint => write!(formatter, "integrity constraint"),
Self::Lemma(_) => write!(formatter, "lemma"),
Self::Assertion => write!(formatter, "assertion"),
Self::Spec => write!(formatter, "spec"),
}
}
}