Skip to content

Comments

saw-core-rocq: support partially-applied Prelude.ite.#3058

Open
chathhorn-galois wants to merge 3 commits intomasterfrom
chathhorn/issue2981
Open

saw-core-rocq: support partially-applied Prelude.ite.#3058
chathhorn-galois wants to merge 3 commits intomasterfrom
chathhorn/issue2981

Conversation

@chathhorn-galois
Copy link
Contributor

Fixes #2981.

Add a 5-arg Prelude.ite test. Refs #2981.
Copy link
Contributor

@brianhuffman brianhuffman left a comment

Choose a reason for hiding this comment

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

Looks good. I can see that the code for handling ite applied to extra arguments was already there, but if we don't already have a test case that exercises that logic then this PR might be a good opportunity to add one.

Copy link
Contributor

@sauclovian-g sauclovian-g left a comment

Choose a reason for hiding this comment

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

I do not immediately see why it's failing; ping me if you'd like me to look into it further

@chathhorn-galois
Copy link
Contributor Author

Looks good. I can see that the code for handling ite applied to extra arguments was already there, but if we don't already have a test case that exercises that logic then this PR might be a good opportunity to add one.

I added a case in the rocq golden-style tests, but let me know if there's somewhere else I should stick it:

let t10 = parse_core "ite (Bool -> Bool) True not (id Bool) False";
write_rocq_term "TestPartialIte_5args" [] [] "" t10;

I do not immediately see why it's failing; ping me if you'd like me to look into it further

It looks like it's yices. I was waiting for their website to come back before re-running.

@chathhorn-galois
Copy link
Contributor Author

It looks like it's yices. I was waiting for their website to come back before re-running.

Oh wait, clearly another problem...

@sauclovian-g
Copy link
Contributor

Yeah, the blst failure is yices upstream (still), the others are something real :-(

@brianhuffman
Copy link
Contributor

Here's the error message from saw-core-rocq-tests:

Error:
In environment
n : nat
a : Type
conds : bitvector n
xs : Vec n a
default : a
The term "id (a -> a)" has type "Type" while it is expected to have type
 "(a -> a) -> a -> a".

It looks like this error happens while translating the (previously skipped) definition of pmux:

pmux : (n : Nat) -> (a : sort 0) -> Vec n Bool -> Vec n a -> a -> a;
pmux n a conds xs default =
  foldr (a -> a) a n (id (a -> a)) default
  (zipWith Bool a (a -> a) (ite a) n conds xs);

This is probably the only definition in the SAWCore prelude that contains an explicit call to id. Are we translating id wrong? It looks like maybe the Rocq id function has an implicit type argument, while we're passing it explicitly.

@sauclovian-g
Copy link
Contributor

Ah, that's probably it.

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.

SAWCore to Rocq translation fails on partial applications of ite

4 participants