Skip to content

Conversation

@joscoh
Copy link
Contributor

@joscoh joscoh commented Jan 30, 2026

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.

@joscoh joscoh requested a review from a team as a code owner January 30, 2026 19:34
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
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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.

@aqjune-aws
Copy link
Contributor

Does it require a change in Strata/DL/Lambda/Semantics.lean? I think the Step relation is defined only when the arguments of concreteEval are isCanonicalValue.

@joscoh
Copy link
Contributor Author

joscoh commented Jan 30, 2026

Does it require a change in Strata/DL/Lambda/Semantics.lean? I think the Step relation is defined only when the arguments of concreteEval are isCanonicalValue.

Yes, that is a good point.

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