You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nested forall! crashes goto-cc with an invariant abort ("quantifier must not contain side effects") instead of a user-facing error #4902
#[kani::proof]fnnested_forall(){
kani::assume(kani::forall!(|i in (0,4)| kani::forall!(|j in (0,4)| i + j < 10)));assert!(true);}
using the following command line invocation:
kani nested_forall.rs -Z quantifiers
with Kani version: reproduces on 0.67.0 and 0.68.0 (latest release as of filing), macOS aarch64.
I expected to see this happen: either the nested quantifier verifies, or a "nested quantifiers are not supported" error.
Instead, this happened: goto-cc aborts (SIGABRT) with a C++ invariant violation:
--- begin invariant violation report ---
Invariant check failed
File: src/ansi-c/goto-conversion/goto_clean_expr.cpp:714 function: clean_expr
Condition: !has_subexpr(expr, ID_side_effect) || (code.operands()[0].id() == ID_side_effect
&& code.operands()[0].get_named_sub()[ID_statement].id() == ID_statement_expression)
Reason: quantifier must not contain side effects
(Backtrace: clean_expr from convert_expression; full trace on request.)
The inner forall! becomes a statement-expression inside the outer quantifier's body, which is what clean_expr rejects (ID_statement_expression). So Kani emits the nested form instead of flattening or rejecting it earlier.
The abort is during goto conversion, before any solver runs, so the backend doesn't matter. With #[kani::solver(z3)] a single forall! verifies but the nested pair still crashes, so this isn't a solver limitation.
Kani already catches some nested-quantifier cases: an indirect variant (a quantified loop invariant calling a contracted function, in a verify-rust-std build at 152c6a8) panics with Detected recursions in the usage of quantifiers. The direct lexical nesting above isn't caught.
Activity
Fix nested quantifier capture projection and guard unsupported safety…