Let's say I have a lambda expression
$$ (\lambda x . (\lambda w.ww)x) y $$
There are a bunch of subterms:
- $(\lambda x . (\lambda w.ww)x) y$
- $\lambda x . (\lambda w.ww)x$
- $(\lambda w.ww)x$
- $\lambda w . ww$
- $ww$
- $w$ (the first one)
- $w$ (the second one)
- $x$
- $y$
Is there a standard way to identify a particular subterm? (Let's say I want to be able to write down "do a beta-reduction on this one particular subterm") Naively, it seems like you could just write down the specific term you're referring to, but then you still have the issue of some subterms being identical. Another option would be to define an iteration order (say, DFS left-first) and then index into that. I'm wondering if there is a technique or standard way to do this.