Map over Array with min or max #6396
Unanswered
andrewthad
asked this question in
Q&A
Replies: 3 comments
-
I think I've figured this out. Using
Are there any caveats to this, or should it work as expected? |
Beta Was this translation helpful? Give feedback.
0 replies
-
There is a difference between using map and lambda:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks. I had forgotten that extensionality necessarily becomes undecidable once lambda is introduced. Also, I figured out a better way to formulate my original function without using
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Z3 lets users map over multiple arrays together. For example:
This works because
and
,>
, and+
are built-in functions. I have not been able to figure out a way to do the same with a user-definedmin
ormax
(binary functions of type(Int Int) (Int)
). According to https://stackoverflow.com/a/19338192/1405768, usingdefine-fun
is not an option. Here's an attempt withlambda
, which I'm not familiar with:Z3 rejects this with
And I don't believe that lambda is even intended to be used this way.
It is possible to work around this by supplying an uninterpreted function and guiding its interpretation by using
assert
everywhere. I'm hoping that doing this is not necessary though.Here is an example of the workaround I described:
Beta Was this translation helpful? Give feedback.
All reactions