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

  • 2 types
  • 48 values
  • PackageAgda-2.7.0.1
  • Exports50
  • LanguageHaskell2010
  • LicenceMIT
  • SourceConversion.hs
valuesameVars :: Elims -> Elims -> Bool
#

Check if to lists of arguments are the same (and all variables). Precondition: the lists have the same length.

valueintersectVars :: Elims -> Elims -> Maybe [Bool]
#

intersectVars us vs checks whether all relevant elements in us and vs are variables, and if yes, returns a prune list which says True for arguments which are different and can be pruned.

valuecompareDom
  1. :: (MonadConversion m, Free c)
  2. => Comparison

    cmp The comparison direction

  3. -> Dom Type

    a1 The smaller domain.

  4. -> Dom Type

    a2 The other domain.

  5. -> Abs b

    b1 The smaller codomain.

  6. -> Abs c

    b2 The bigger codomain.

  7. -> m ()

    Continuation if mismatch in Hiding.

  8. -> m ()

    Continuation if mismatch in Relevance.

  9. -> m ()

    Continuation if mismatch in Quantity.

  10. -> m ()

    Continuation if mismatch in Cohesion.

  11. -> m ()

    Continuation if mismatch in annFinite.

  12. -> m ()

    Continuation if comparison is successful.

  13. -> m ()
#

Check whether a1 cmp a2 and continue in context extended by a1.

When comparing argument spines (in compareElims) where the first arguments don't match, we keep going, substituting the anti-unification of the two terms in the telescope. More precisely:

@ (u = v : A)[pid] w = antiUnify pid A u v us = vs : Δ[w/x] ------------------------------------------------------------- u us = v vs : (x : A) Δ @

The simplest case of anti-unification is to return a fresh metavariable (created by blockTermOnProblem), but if there's shared structure between the two terms we can expose that.

This is really a crutch that lets us get away with things that otherwise would require heterogenous conversion checking. See for instance issue #2384.

valuecompareIrrelevant :: MonadConversion m => Type -> Term -> Term -> m ()
#

Compare two terms in irrelevant position. This always succeeds. However, we can dig for solutions of irrelevant metas in the terms we compare. (Certainly not the systematic solution, that'd be proof search...)

Types

4 declarations
valuecoerce
  1. :: (MonadConversion m, MonadTCM m)
  2. => Comparison
  3. -> Term
  4. -> Type
  5. -> Type
  6. -> m Term
#

coerce v a b coerces v : a to type b, returning a v' : b with maybe extra hidden applications or hidden abstractions.

In principle, this function can host coercive subtyping, but currently it only tries to fix problems with hidden function types.

valuecoerceSize
  1. :: MonadConversion m
  2. => Type -> Type -> m ()
  3. -> Term
  4. -> Type
  5. -> Type
  6. -> m ()
#

Account for situations like k : (Size< j) <= (Size< k + 1)

Actually, the semantics is (Size<= k) ∩ (Size< j) ⊆ rhs which gives a disjunctive constraint. Mmmh, looks like stuff TODO.

For now, we do a cheap heuristics.

Sorts and levels

15 declarations
valueleqSort :: MonadConversion m => Sort -> Sort -> m ()
#

Check that the first sort is less or equal to the second.

We can put SizeUniv below Inf, but otherwise, it is unrelated to the other universes.

valueleqConj :: MonadConversion m => Conj -> Conj -> m Bool
#

leqConj r q = r ≤ q in the I lattice, when r and q are conjuctions. ' (∧ r_i) ≤ (∧ q_j) iff ' (∧ r_i) ∧ (∧ q_j) = (∧ r_i) iff ' {r_i | i} ∪ {q_j | j} = {r_i | i} iff ' {q_j | j} ⊆ {r_i | i}

Definitions

1 declaration