HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

ModuleAgda-2.7.0.1Haskell2010

Agda.TypeChecking.Primitive.Cubical.Base

Implementations of the basic primitives of Cubical Agda: The interval and its operations.

  • 4 types
  • 20 values
  • PackageAgda-2.7.0.1
  • Exports24
  • LanguageHaskell2010
  • LicenceMIT
  • SourceBase.hs
valuerequireCubical
  1. :: Cubical

    Which variant of Cubical Agda is required?

  2. -> String

    Why, exactly, do we need Cubical to be enabled?

  3. -> TCM ()
#

Checks that the correct variant of Cubical Agda is activated. Note that --erased-cubical "counts as" --cubical in erased contexts.

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.

Negation on the interval. Negation satisfies De Morgan's laws, and their implementation is handled here.

datadata KanOperation
#

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.

Constructors

  • 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.

    • kanOpCofib :: Blocked (Arg Term)

      When this cofibration holds, the transport must definitionally be the identity. This is handled generically by primTransHComp but specific Kan operations may still need it.

    • kanOpBase :: Arg Term

      This is the term in A i0 which we are transporting.

  • 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.

    • kanOpCofib :: Blocked (Arg Term)

      When this cofibration holds, the transport must definitionally be the identity. This is handled generically by primTransHComp but specific Kan operations may still need it.

    • kanOpSides :: Arg Term

      The partial element itself

    • kanOpBase :: Arg Term

      This is the term in A i0 which we are transporting.

datadata TermPosition
#

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.)

Instances2Eq, Show
  • Eq TermPositionDefined in Agda-2.7.0.1 · Agda.TypeChecking.Primitive.Cubical.Base
  • Show TermPositionDefined in Agda-2.7.0.1 · Agda.TypeChecking.Primitive.Cubical.Base
valueheadStop :: PureTCM m => TermPosition -> m Term -> m Bool
#

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 to t;

  • when we're under an unglue, i.e. in Eliminated TermPosition, in which case we reduce to a.

datadata FamilyOrNot a
#

Are we looking at a family of things, or at a single thing?

Constructors

Instances6Functor, Foldable, Traversable, Eq, Show, Reduce

Helper functions for building terms

8 declarations
valuecombineSys
  1. :: HasBuiltins m
  2. => NamesT m Term
  3. -> NamesT m Term
  4. -> [(NamesT m Term, NamesT m Term)]

    A list of (ψ, PartialP ψ λ o → A (... o ...)) mappings. Note that by definitional proof-irrelevance of IsOne, the actual injection can not matter here.

  5. -> 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.