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

Add cv_eval_pat to cv_transLib (and an example) #1406

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

myreen
Copy link
Contributor

@myreen myreen commented Feb 24, 2025

No description provided.

@myreen myreen changed the title Add cv_eval_raw_save to cv_transLib (and an example) Add cv_eval_pat to cv_transLib (and an example) Feb 24, 2025
| Eval of conv
| Name of string
| Tuple of pat list
| Some of pat;
Copy link
Member

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]?

Copy link
Contributor Author

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:

(* 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.
*)

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

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.

3 participants