Deciding appears_free_in v t, which is used in no_capture in the rename relation, requires traversing the whole term t, which results in quadratic run-time when checked throughout the AST.
A more efficient approach would be to maintain a set of free variables in the sub-term, and compute that recursively (synthesized). Deciding can then be done in terms of that set. This approach does require an equivalence between appears_free_in v t and In v (fv t) to construct the soundness proof.
Deciding
appears_free_in v t
, which is used inno_capture
in therename
relation, requires traversing the whole termt
, which results in quadratic run-time when checked throughout the AST.A more efficient approach would be to maintain a set of free variables in the sub-term, and compute that recursively (synthesized). Deciding can then be done in terms of that set. This approach does require an equivalence between
appears_free_in v t
andIn v (fv t)
to construct the soundness proof.