Skip to content

[Request] Allow function calls in quantifier bodies. #7774

Open
@JustusAdam

Description

@JustusAdam

Function calls are currently supported in function contracts, however they are not allowed in quantifiers. This is inconsistent and unintuitive, since the logical restrictions for function calls in contracts apply the same way in quantifiers.

Having the capability to call functions in quantifiers is important for the implementation of model-checking/kani#2546. This is for two reasons

  1. The code generation in that implementation turns the body of Rust-level quantifiers into a function and then calls that function from the goto-C-level quantifier. This could be worked around but
  2. Small functions (especially methods) are very common in Rust, e.g. the std::ops::Eq::eq function which overloads == or std::ops::Ord::cmp which overloads comparison. As a result these are likely to be used by users of kani's function contracts.

I would ask that CBMC should lift the arbitrary restriction on function calls in quantifiers and enforce side-effect freedom the same way it does in function contracts otherwise.

Metadata

Metadata

Assignees

Labels

KaniBugs or features of importance to Kani Rust VerifierawsBugs or features of importance to AWS CBMC users

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions