Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_const_array and Distinct with &[impl Borrow<Self>] #250

Merged
merged 2 commits into from
Oct 13, 2023

Conversation

Pat-Lafon
Copy link
Contributor

  • Distinct currently takes &[&Self] for which I would like to do a similar api relaxing like in Use Borrow in varop arrays #246.
  • With the new Rust version, there is a minor clippy change.
  • Python has this nice is_const_array(a) function which I would like to propose here.

z3/src/ast.rs Outdated
@@ -1525,6 +1528,26 @@ impl<'ctx> Array<'ctx> {
})
}
}

/// Returns true if the array is a const array(a.is_const_array() <=> exists v, forall i. select(a, i) == v)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is coming from

z3.rs/z3-sys/src/lib.rs

Lines 520 to 522 in 3c97663

/// The constant array. For example, `select(const(v),i) = v`
/// holds for every `v` and `i`. The function is unary.
CONST_ARRAY = generated::Z3_decl_kind::Z3_OP_CONST_ARRAY as u32,
. So I believe so? Maybe only a single implication now that I think of it because I'm not sure if a nested store gets collapsed. (store (store ((as const (Array Int Int)) 9) 0 1281) 0 9)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that was your concerned, I changed that comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I had commented while doing something else and from my phone away from home.

My concern was actually about the formatting and if that should be in the summary line at the top of the comment.

Should also have a blank line before the example header.

z3/tests/lib.rs Outdated Show resolved Hide resolved
@waywardmonkeys
Copy link
Contributor

Could you squash the various commits for is_const_array into a single commit? After removing the clippy fix (already on master), that would leave one commit for the Distinct change and one for is_const_array.

@waywardmonkeys waywardmonkeys merged commit 5a09143 into prove-rs:master Oct 13, 2023
7 checks passed
@waywardmonkeys
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants