6 if (
auto app = lam->
body()->isa<
App>()) {
7 if (app->arg() == lam->
var())
return app;
14 name_ += callee_only_ ?
" tt" :
" ff";
18 for (
size_t i = 0, e = def->
num_ops(); i != e; ++i) {
21 if (
auto app =
eta_rule(lam); app && !irreducible_.contains(lam)) {
23 auto new_def = def->
refine(i, app->callee());
24 DLOG(
"eta-reduction '{}' -> '{}' by eliminating '{}'", def, new_def, lam);
36 auto succ = irreducible_.emplace(lam).second;
38 DLOG(
"irreducible: {}; found {}", lam, var);
bool is_set() const
Yields true if empty or the last op is set.
const Def * refine(size_t i, const Def *new_op) const
T * isa_mut() const
If this is mutable, it will cast constness away and perform a dynamic_cast to T.
const Def * op(size_t i) const noexcept
const Def * var(nat_t a, nat_t i) noexcept
constexpr size_t num_ops() const noexcept
@ Reduce
η-reduction performed.
void apply(bool callee_only)
const Def * rewrite(const Def *) override
undo_t analyze(const Var *) override
undo_t undo_visit(Def *mut) const
A variable introduced by a binder (mutable).
#define DLOG(...)
Vaporizes to nothingness in Debug build.
static const App * eta_rule(Lam *lam)
const App * isa_callee(const Def *def, size_t i)
static constexpr undo_t No_Undo