lang::typecheck::cubical
lang/src/typecheck/cubical.mo
pub struct PathParts {
line : Term,
left : Term,
right : Term,
}The three components of a saturated PathP: the LINE of types the
path lives over, and the LEFT/RIGHT endpoint values.
pub def path_parts_of (t : Term) : Option PathPartsPeel t into PathParts if it is a SATURATED PathP type -- the
shape type_check_cubical rebuilds and the path-abstraction and
path-application rules match on. A pathp primitive with the wrong
argument count answers none: the arity table rejects it at formation
and no later rule should have an opinion about a malformed one.
pub def peels_to_bare_interval (t : Term) : BoolIs t the BARE interval -- I itself, not a dimension expression?
The line-domain and path-binder rules ask this of a CHECKED term (the
checked term is what carries the cubical rewrite a raw source
spelling does not), which is why this takes a Term rather than a
CubicalPrim.
pub def endpoint_of (t : Term) : Option CubicalPrimWhich ENDPOINT a checked term is, if it is one: bare i0 or bare i1.
The path-application rule's mitigation keys on this (see
extract_pi_ret in lang/typecheck/infer.mo); a dimension EXPRESSION
-- ineg i, imeet i j -- answers none even though it evaluates to an
endpoint at the boundary, because at the application site it has not
been substituted yet. The caller that has substituted normalizes
first.