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

[CN] Pure term (partial) evaluation #447

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ZippeyKeys12
Copy link
Collaborator

@ZippeyKeys12 ZippeyKeys12 commented Jul 30, 2024

Evaluates terms (IndexTerms.t). Can be used for term simplification.
It is needed to evaluate terms when generating test cases in OCaml-land.

Potential issues

  • It's supposed to get stuck on errors, but it still might throw exceptions due to the functions used (ex: List.combine)
    • Some of these checks could be omitted, assuming the term is well-typed.

Other

  • No sets, pointer ops, casts and a few other operations

@dc-mak dc-mak removed their request for review July 30, 2024 09:08
@dc-mak
Copy link
Contributor

dc-mak commented Jul 30, 2024

It would be useful if you could explain why as well as what. I'm off on holiday for until 12th, so I'll let Christopher handle this.

backend/cn/lib/eval.ml Outdated Show resolved Hide resolved
backend/cn/lib/eval.ml Outdated Show resolved Hide resolved
let eval_num_binop = eval_num_binop eval_aux bt here in
match t_ with
| Const _ -> return it
| Sym x -> Result.error (Sym.pp_string x ^ " is free")
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we want to be able to use eval to simplify quantified constraints or assertions, then it can't crash on free variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It doesn't crash, it returns Error, which partial_eval accounts for (and is what would be used for simplification).

backend/cn/lib/eval.ml Outdated Show resolved Hide resolved
backend/cn/lib/eval.ml Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants