In Agda, irrelevance is an annotation which marks a parameter, record field, or definition which "will only be typechecked but never evaluated", with the consequence that irrelevant arguments and record fields are ignored when checking equality.
You can define records with irrelevant fields, e.g. this "Squash" type whose elements are definitionally equal:
record Squash {ℓ} (A : Set ℓ) : Set ℓ where
constructor squash
field
.unsquash : A
open Squash
and these fields are counted in absurd patterns, e.g.
foo : Squash ⊥ → ⊥
foo ()
but by default the projection .unsquash : Squash A → A
doesn't actually exist, meaning you can't directly use irrelevant fields, even in an irrelevant context!
There is an option --irrelevant-projections which adds irrelevant projections for irrelevant record fields, but it's incompatible with --safe
. Being able to use an irrelevant field in an irrelevant context seems pretty innocuous, so why is --irrelevant-projections
unsafe?
--irrelevant-projections
related to type-in-type assumptions? If so, do you have any input on this question? $\endgroup$