-
Notifications
You must be signed in to change notification settings - Fork 23
Fix #361, ensure tester-constructor pairs simplify #364
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
base: main
Are you sure you want to change the base?
Conversation
| match σ.config.factory.callOfLFunc e with | ||
| | some (op_expr, args, lfunc) => | ||
| let args := args.map (fun a => eval n' σ a) | ||
| let firstArgIsConstr := (args.head?.map (isConstrApp σ.config.factory)).getD false |
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.
Just checking: inline_if_constr is an attribute meaningful only for tester functions. This allows tester functions to be inlined if their (only) argument is a constructor (but not otherwise).
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.
Yes. In principle one could write a Factory function that evaluates on a constructor argument, but right now it is only meaningful for testers and eliminators.
| -- All arguments in the function call are concrete. | ||
| -- We can, provided a denotation function, evaluate this function | ||
| -- call. | ||
| ("eval_if_constr" ∈ lfunc.attr && firstArgIsConstr) then |
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.
And checking yet again: eval_if_constr is an attribute that's meaningful only for eliminator functions, and allows their concrete evaluation (via concreteEval) only if the first argument is a constructor.
|
Does it require a change in Strata/DL/Lambda/Semantics.lean? I think the |
Yes, that is a good point. |
Issue #, if available: #361
Description of changes:
Changes concrete evaluator to simplify certain marked function applications when the first argument is a constructor, no matter if the arguments are values or not.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.