51 if (
auto pi = d->isa_mut<
Pi>(); pi && pi->
is_implicit())
return pi;
252 if (
auto app = def->isa<
App>())
return {app, app->callee()->isa_mut<
Lam>()};
253 return {
nullptr,
nullptr};
257std::deque<const App*>
decurry(Ref);
const Pi * callee_type() const
const Axiom * axiom() const
Ref rebuild_(World &, Ref, Defs) const override
const App * decurry() const
Returns App::callee again as App.
static constexpr auto Node
bool is_set() const
Yields true if empty or the last op is set.
Ref var()
Not necessarily a Var: E.g., if the return type is [], this will yield ().
Def * set(size_t i, Ref)
Successively set from left to right.
DefVec reduce(Ref arg) const
Rewrites Def::ops by substituting this mutable's Var with arg.
Def * unset()
Unsets all Def::ops; works even, if not set at all or partially.
Lam * app(Filter filter, Ref callee, Ref arg)
Set body to an App of callee and arg.
Lam * set(Filter filter, Ref body)
Lam * set_filter(Filter)
Set filter first.
static Lam * isa_mut_basicblock(Ref d)
Only for mutables.
Lam * stub_(World &, Ref) override
const Pi * ret_pi() const
static Lam * isa_mut_returning(Ref d)
Only for mutables.
static constexpr auto Node
static Lam * isa_mut_cn(Ref d)
Only for mutables.
Lam * set_body(Ref body)
Set body second.
static const Lam * isa_cn(Ref d)
static const Lam * isa_basicblock(Ref d)
std::variant< bool, Ref > Filter
Ref rebuild_(World &, Ref, Defs) const override
Lam * test(Filter filter, Ref val, Ref idx, Ref match, Ref clash, Ref mem)
Lam * branch(Filter filter, Ref cond, Ref t, Ref f, Ref mem=nullptr)
Set body to an App of (f, t)#cond mem or (f, t)#cond () if mem is nullptr.
Ref ret_var()
Yields the Lam::var of the Lam::ret_pi.
static const Lam * isa_returning(Ref d)
A dependent function type.
static const Pi * isa_returning(Ref d)
Is this a continuation (Pi::isa_cn) which has a Pi::ret_pi?
static Ref infer(Ref dom, Ref codom)
static Pi * isa_implicit(Ref d)
Is d an Pi::is_implicit (mutable) Pi?
Pi(const Def *type, bool implicit)
Constructor for a *mut*able Pi.
Pi * set_codom(Ref codom)
Pi(const Def *type, const Def *dom, const Def *codom, bool implicit)
Constructor for an immutable Pi.
Ref reduce(Ref arg) const
Pi * set(Ref dom, Ref codom)
Ref rebuild_(World &, Ref, Defs) const override
Pi * stub_(World &, Ref) override
static constexpr auto Node
const Pi * immutabilize() override
Tries to make an immutable from a mutable.
static const Pi * isa_cn(Ref d)
Is this a continuation - i.e. is the Pi::codom mim::Bottom?
static const Pi * isa_basicblock(Ref d)
Is this a continuation (Pi::isa_cn) that is not Pi::isa_returning?
static const Pi * ret_pi(Ref d)
const Pi * ret_pi() const
Yields the last Pi::dom, if it Pi::isa_basicblock.
Ref ret_dom() const
Pi::domain of Pi::ret_pi.
Helper class to retrieve Infer::arg if present.
CRTP-based Mixin to declare setters for Def::loc & Def::name using a covariant return type.
This is a thin wrapper for std::span<T, N> with the following additional features:
The World represents the whole program and manages creation of MimIR nodes (Defs).
#define MIM_PROJ(NAME, CONST)
Use as mixin to wrap all kind of Def::proj and Def::projs variants.
const App * isa_callee(Ref def, size_t i)
std::deque< const App * > decurry(Ref)
Yields curried Apps in a flat std::deque<const App*>.
std::pair< Ref, DefVec > collect_args(Ref def)
Helper function to cope with the fact that normalizers take all arguments and not only its axiom argu...
absl::flat_hash_set< K, GIDHash< K >, GIDEq< K > > GIDSet
GIDMap< Lam *, To > LamMap
Lam * isa_workable(Lam *lam)
These are Lams that are neither nullptr, nor Lam::is_external, nor Lam::is_unset.
absl::flat_hash_map< K, V, GIDHash< K >, GIDEq< K > > GIDMap
std::pair< const App *, Lam * > isa_apped_mut_lam(Ref def)
Ref compose_cn(Ref f, Ref g)
The high level view is: