-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add cv_eval_pat to cv_transLib (and an example) #1406
base: develop
Are you sure you want to change the base?
Conversation
| Eval of conv | ||
| Name of string | ||
| Tuple of pat list | ||
| Some of pat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between Some p
and Tuple [p]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment makes me realise that it's unclear what the pattern means. I wrote a long comment in the file, see:
HOL/examples/cv_compute/cv_eval_exampleScript.sml
Lines 15 to 24 in e211611
(* The following example demonstrates that the given pattern, | |
Some (Tuple ...), instructs cv_eval_pat what to do with the | |
result of evaluation. In this example, we can see that the | |
result must be a SOME containing a tuple and the elements | |
of the tuple are handled as follows. | |
- The first is just directly evaluated. | |
- The second is left untouched after the raw cv computation. | |
- The third is stored in a new constant, big_replicate, that | |
can be used in subsequent calls to cv_trans, cv_eval, etc. | |
*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is Tuple [Some (Tuple [])]
just not really supposed to be used? Or does that also make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cv_eval_pat
will raise an exception if users write Tuple []
in their pattern.
Writing Tuple [x]
will mean the same as a single-element tuple in HOL, i.e. it's not a tuple. What's the difference between (2)
and 2
in HOL? No difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some additional context: the constructor Tuple
was originally Pair
(which avoids some of the above issues). However, the Pair
constructor would need to be disambiguated because it is also used elsewhere in CV.
No description provided.