Zulip Chat Archive
Stream: metaprogramming / tactics
Topic: Reducing match expressions in expression
Leni Aniva (Jul 27 2025 at 19:40):
If I have an expression of the form
(match x.succ, n.succ with
| a, Nat.zero => a
| a, b.succ => (a.add b).succ) =
(x.add n.succ).succ
Is there a function that can reduce this expression by evaluating the match? I tried Meta.whnf and Core.betaReduce and they could not change the expression.
Aaron Liu (Jul 27 2025 at 19:41):
it's already in whnf so that won't do anything
Leni Aniva (Jul 27 2025 at 19:44):
Aaron Liu said:
it's already in whnf so that won't do anything
Is there anything else that can perform the reduction? I also tried to programatically delta-expand matchers and beta reduce, and the furthest I could get was
(Nat.casesOn n.succ x.succ fun n => (x.succ.add n).succ) = (x.add n.succ).succ
which still has a recursor, while the match above could be reduced to (x.succ.add n).succ
Robin Arnez (Jul 27 2025 at 19:44):
lhs then whnf?
Leni Aniva (Jul 27 2025 at 19:45):
Robin Arnez said:
lhs then
whnf?
seems like this is the best way to do it
Last updated: Dec 20 2025 at 21:32 UTC