Rename “assert” statement to “spec”
This commit is contained in:
parent
116f74f63e
commit
739cae1f7c
@ -1,3 +1,3 @@
|
|||||||
input: p/2.
|
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).
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
input: p/1.
|
input: p/1.
|
||||||
|
|
||||||
assert:
|
spec:
|
||||||
forall N
|
forall N
|
||||||
(
|
(
|
||||||
forall X (p(X) -> exists I exists M (I = M and I = X and I <= N))
|
forall X (p(X) -> exists I exists M (I = M and I = X and I <= N))
|
||||||
|
@ -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
|
# 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)).
|
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).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ output: in/1.
|
|||||||
assume: forall X, Y (s(X, Y) -> is_int(Y)).
|
assume: forall X, Y (s(X, Y) -> is_int(Y)).
|
||||||
|
|
||||||
# Only valid sets can be included in the solution
|
# 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
|
# 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
|
# 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).
|
||||||
|
@ -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)))).
|
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)).
|
#spec: 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)).
|
#spec: 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)).
|
spec: 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 N (prime(N) <-> N > 1 and N <= n and not exists I, J (I > 1 and J > 1 and I * J = N)).
|
||||||
|
@ -364,16 +364,16 @@ pub(crate) fn parse_specification(mut input: &str, problem: &crate::Problem)
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
"assert" =>
|
"spec" =>
|
||||||
{
|
{
|
||||||
let (formula, remaining_input) = formula_statement_body(input, problem)?;
|
let (formula, remaining_input) = formula_statement_body(input, problem)?;
|
||||||
|
|
||||||
input = remaining_input;
|
input = remaining_input;
|
||||||
|
|
||||||
let statement = crate::problem::Statement::new(
|
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;
|
continue;
|
||||||
},
|
},
|
||||||
|
@ -190,7 +190,8 @@ impl Problem
|
|||||||
{
|
{
|
||||||
self.print_step_title("Started",
|
self.print_step_title("Started",
|
||||||
termcolor::ColorSpec::new().set_bold(true).set_fg(Some(termcolor::Color::Green)))?;
|
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())?;
|
&termcolor::ColorSpec::new())?;
|
||||||
|
|
||||||
let mut statements = self.statements.borrow_mut();
|
let mut statements = self.statements.borrow_mut();
|
||||||
@ -229,7 +230,7 @@ impl Problem
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.print_step_title("Finished", &step_title_color)?;
|
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
|
if proof_direction == ProofDirection::Both
|
||||||
@ -242,7 +243,8 @@ impl Problem
|
|||||||
{
|
{
|
||||||
self.print_step_title("Started",
|
self.print_step_title("Started",
|
||||||
termcolor::ColorSpec::new().set_bold(true).set_fg(Some(termcolor::Color::Green)))?;
|
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())?;
|
&termcolor::ColorSpec::new())?;
|
||||||
|
|
||||||
let mut statements = self.statements.borrow_mut();
|
let mut statements = self.statements.borrow_mut();
|
||||||
@ -256,7 +258,7 @@ impl Problem
|
|||||||
{
|
{
|
||||||
StatementKind::Axiom
|
StatementKind::Axiom
|
||||||
| StatementKind::Assumption
|
| StatementKind::Assumption
|
||||||
| StatementKind::Assertion =>
|
| StatementKind::Spec =>
|
||||||
statement.proof_status = ProofStatus::AssumedProven,
|
statement.proof_status = ProofStatus::AssumedProven,
|
||||||
StatementKind::Lemma(ProofDirection::Forward) =>
|
StatementKind::Lemma(ProofDirection::Forward) =>
|
||||||
statement.proof_status = ProofStatus::Ignored,
|
statement.proof_status = ProofStatus::Ignored,
|
||||||
@ -280,7 +282,7 @@ impl Problem
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.print_step_title("Finished", &step_title_color)?;
|
self.print_step_title("Finished", &step_title_color)?;
|
||||||
println!("verification of translated program from assertions");
|
println!("verification of translated program from specification");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -537,6 +539,7 @@ impl<'p> std::fmt::Display for ProblemTPTPDisplay<'p>
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: refactor
|
||||||
let title = match section_kind
|
let title = match section_kind
|
||||||
{
|
{
|
||||||
SectionKind::CompletedDefinitions => "completed definitions",
|
SectionKind::CompletedDefinitions => "completed definitions",
|
||||||
@ -544,7 +547,7 @@ impl<'p> std::fmt::Display for ProblemTPTPDisplay<'p>
|
|||||||
SectionKind::Axioms => "axioms",
|
SectionKind::Axioms => "axioms",
|
||||||
SectionKind::Assumptions => "assumptions",
|
SectionKind::Assumptions => "assumptions",
|
||||||
SectionKind::Lemmas => "lemmas",
|
SectionKind::Lemmas => "lemmas",
|
||||||
SectionKind::Assertions => "assertions",
|
SectionKind::Specs => "specs",
|
||||||
};
|
};
|
||||||
|
|
||||||
write_title(formatter, title, section_separator)?;
|
write_title(formatter, title, section_separator)?;
|
||||||
|
@ -7,7 +7,7 @@ pub enum SectionKind
|
|||||||
Lemmas,
|
Lemmas,
|
||||||
CompletedDefinitions,
|
CompletedDefinitions,
|
||||||
IntegrityConstraints,
|
IntegrityConstraints,
|
||||||
Assertions,
|
Specs,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for SectionKind
|
impl std::fmt::Debug for SectionKind
|
||||||
@ -21,7 +21,7 @@ impl std::fmt::Debug for SectionKind
|
|||||||
Self::Axioms => write!(formatter, "axiom"),
|
Self::Axioms => write!(formatter, "axiom"),
|
||||||
Self::Assumptions => write!(formatter, "assumption"),
|
Self::Assumptions => write!(formatter, "assumption"),
|
||||||
Self::Lemmas => write!(formatter, "lemma"),
|
Self::Lemmas => write!(formatter, "lemma"),
|
||||||
Self::Assertions => write!(formatter, "assertion"),
|
Self::Specs => write!(formatter, "spec"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ pub(crate) enum StatementKind
|
|||||||
CompletedDefinition(std::rc::Rc<crate::PredicateDeclaration>),
|
CompletedDefinition(std::rc::Rc<crate::PredicateDeclaration>),
|
||||||
IntegrityConstraint,
|
IntegrityConstraint,
|
||||||
Lemma(ProofDirection),
|
Lemma(ProofDirection),
|
||||||
Assertion,
|
Spec,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for StatementKind
|
impl std::fmt::Debug for StatementKind
|
||||||
@ -23,7 +23,7 @@ impl std::fmt::Debug for StatementKind
|
|||||||
write!(formatter, "completed definition of {}", predicate_declaration.declaration),
|
write!(formatter, "completed definition of {}", predicate_declaration.declaration),
|
||||||
Self::IntegrityConstraint => write!(formatter, "integrity constraint"),
|
Self::IntegrityConstraint => write!(formatter, "integrity constraint"),
|
||||||
Self::Lemma(_) => write!(formatter, "lemma"),
|
Self::Lemma(_) => write!(formatter, "lemma"),
|
||||||
Self::Assertion => write!(formatter, "assertion"),
|
Self::Spec => write!(formatter, "spec"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user