Safe Haskell | None |
---|---|
Language | Haskell2010 |
Implementations of the basic primitives of Cubical Agda: The interval and its operations.
Synopsis
- requireCubical :: Cubical -> String -> TCM ()
- primIntervalType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Type
- primIMin' :: TCM PrimitiveImpl
- primIMax' :: TCM PrimitiveImpl
- primDepIMin' :: TCM PrimitiveImpl
- primINeg' :: TCM PrimitiveImpl
- imax :: HasBuiltins m => m Term -> m Term -> m Term
- imin :: HasBuiltins m => m Term -> m Term -> m Term
- ineg :: HasBuiltins m => m Term -> m Term
- data Command
- data KanOperation
- kanOpName :: KanOperation -> String
- data TermPosition
- = Head
- | Eliminated
- headStop :: PureTCM m => TermPosition -> m Term -> m Bool
- data FamilyOrNot a
- familyOrNot :: IsString p => FamilyOrNot a -> p
- combineSys :: forall (m :: Type -> Type). HasBuiltins m => NamesT m Term -> NamesT m Term -> [(NamesT m Term, NamesT m Term)] -> NamesT m Term
- combineSys' :: forall (m :: Type -> Type). HasBuiltins m => NamesT m Term -> NamesT m Term -> [(NamesT m Term, NamesT m Term)] -> NamesT m (Term, Term)
- fiber :: forall (m :: Type -> Type). (HasBuiltins m, HasConstInfo m) => NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term
- hfill :: forall (m :: Type -> Type). (HasBuiltins m, HasConstInfo m) => NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term
- decomposeInterval' :: HasBuiltins m => Term -> m [(IntMap BoolSet, [Term])]
- decomposeInterval :: HasBuiltins m => Term -> m [(IntMap Bool, [Term])]
- reduce2Lam :: Term -> ReduceM (Blocked Term)
- isCubicalSubtype :: PureTCM m => Type -> m (Maybe (Term, Term, Term, Term))
Documentation
:: Cubical | Which variant of Cubical Agda is required? |
-> String | Why, exactly, do we need Cubical to be enabled? |
-> TCM () |
Checks that the correct variant of Cubical Agda is activated.
Note that --erased-cubical
"counts as" --cubical
in erased
contexts.
primIntervalType :: (HasBuiltins m, MonadError TCErr m, MonadTCEnv m, ReadTCState m) => m Type Source #
Our good friend the interval type.
primIMin' :: TCM PrimitiveImpl Source #
Implements both the min
connection and conjunction on the
cofibration classifier.
primIMax' :: TCM PrimitiveImpl Source #
Implements both the max
connection and disjunction on the
cofibration classifier.
primDepIMin' :: TCM PrimitiveImpl Source #
primDepIMin
expresses that cofibrations are closed under Σ
.
Thus, it serves as a dependent version of primIMin
(which, recall,
implements _∧_
). This is required for the construction of the Kan
operations in Id
.
primINeg' :: TCM PrimitiveImpl Source #
Negation on the interval. Negation satisfies De Morgan's laws, and their implementation is handled here.
imax :: HasBuiltins m => m Term -> m Term -> m Term Source #
A helper for evaluating max
on the interval in TCM&co.
imin :: HasBuiltins m => m Term -> m Term -> m Term Source #
A helper for evaluating min
on the interval in TCM&co.
ineg :: HasBuiltins m => m Term -> m Term Source #
A helper for evaluating neg
on the interval in TCM&co.
data KanOperation Source #
Our Kan operations are transp
and hcomp
. The KanOperation
record stores the data associated with a Kan operation on arbitrary
types: A cofibration and an element of that type.
TranspOp | A transport problem consists of a cofibration, marking where the transport is constant, and a term to move from the fibre over i0 to the fibre over i1. |
HCompOp | A composition problem consists of a partial element and a base. Semantically, this is justified by the types being Kan fibrations, i.e., having the lifting property against trivial cofibrations. While the specified cofibration may not be trivial, (φ ∨ ~ r) for r ∉ φ is *always* a trivial cofibration. |
|
kanOpName :: KanOperation -> String Source #
The built-in name associated with a particular Kan operation.
data TermPosition Source #
For the Kan operations in Glue
and hcomp {Type}
, we optimise
evaluation a tiny bit by differentiating the term produced when
evaluating a Kan operation by itself vs evaluating it under unglue
.
(See headStop
below.)
Instances
Show TermPosition Source # | |
Defined in Agda.TypeChecking.Primitive.Cubical.Base showsPrec :: Int -> TermPosition -> ShowS # show :: TermPosition -> String # showList :: [TermPosition] -> ShowS # | |
Eq TermPosition Source # | |
Defined in Agda.TypeChecking.Primitive.Cubical.Base (==) :: TermPosition -> TermPosition -> Bool # (/=) :: TermPosition -> TermPosition -> Bool # |
headStop :: PureTCM m => TermPosition -> m Term -> m Bool Source #
Kan operations for the "unstable" type formers (Glue
, hcomp {Type}
) are
computed "negatively": they never actually produce a glue φ t a
term. Instead,
we block the computation unless such a term would reduce further, which happens
in two cases:
- when the formula
φ
is i1, in which case we reduce tot
; - when we're under an
unglue
, i.e. inEliminated
TermPosition
, in which case we reduce toa
.
data FamilyOrNot a Source #
Are we looking at a family of things, or at a single thing?
Instances
familyOrNot :: IsString p => FamilyOrNot a -> p Source #
Helper functions for building terms
:: forall (m :: Type -> Type). HasBuiltins m | |
=> NamesT m Term | |
-> NamesT m Term | |
-> [(NamesT m Term, NamesT m Term)] | A list of |
-> NamesT m Term |
Build a partial element. The type of the resulting partial element
can depend on the computed extent, which we denote by φ
here. Note
that φ
is the n-ary disjunction of all the ψ
s.
combineSys' :: forall (m :: Type -> Type). HasBuiltins m => NamesT m Term -> NamesT m Term -> [(NamesT m Term, NamesT m Term)] -> NamesT m (Term, Term) Source #
Build a partial element, and compute its extent. See combineSys
for the details.
fiber :: forall (m :: Type -> Type). (HasBuiltins m, HasConstInfo m) => NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term Source #
Helper function for constructing the type of fibres of a function over a given point.
hfill :: forall (m :: Type -> Type). (HasBuiltins m, HasConstInfo m) => NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term -> NamesT m Term Source #
Helper function for constructing the filler of a given composition problem.
decomposeInterval' :: HasBuiltins m => Term -> m [(IntMap BoolSet, [Term])] Source #
Decompose an interval expression φ : I
into a set of possible
assignments for the variables mentioned in φ
, together any leftover
neutral terms that could not be put into IntervalView
form.
decomposeInterval :: HasBuiltins m => Term -> m [(IntMap Bool, [Term])] Source #
Decompose an interval expression i : I
as in
decomposeInterval'
, but discard any inconsistent mappings.