You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Finite equality for empty domains breaks subject reduction #6016
cubicalCubical Agda paraphernalia: Paths, Glue, partial elements, hcomp, transpsubject reductionIf you look away, this issue will reduce to a term with a different typetype: bugIssues and pull requests about actual bugs
{-# OPTIONS --cubical --safe --two-level #-}moduleripleywhereopen importAgda.Primitive.Cubicalopen importAgda.PrimitiverecordLiftₛ (A :Set) : SSet whereconstructorliftfieldlower : A
dataBool:Setwherett ff : Bool
dataIdₛ {ℓ} (A : SSet ℓ) (a : A) : A → SSet ℓ wherereflₛ : Idₛ A a a
module_ (p : IsOne i0) wheremodule_ (theₛ :∀ {ℓ} {A :Set ℓ} → Partial i0 A → A) wheref : Partial i0 Bool
f =λ _ → tt
g : Partial i0 Bool
g =λ _ → ff
h : Idₛ (Liftₛ Bool) (lift (theₛ f)) (lift (theₛ g))
h = reflₛ
i : Idₛ (Liftₛ Bool) (lift tt) (lift ff)
i = h λ f → f p
k : Idₛ (Liftₛ Bool) (lift tt) (lift ff)
k ={! i !}
Try asking for the normal form of i in the right-hand-side of k, and you'll see that Agda says it's reflₛ. To clarify: I'm not pointing out that assuming IsOne i0 (which is empty) lets you prove true ≡ false. I'm pointing out that I've managed to convince Agda that true and false are definitionally equal.
Reacted by Anqur, Jon Sterling, Astra Kolomatskaia, Szumi Xie, Emily Pillmore and András Kovács
Reacted by Jon Sterling, Astra Kolomatskaia and Tesla Zhang
Reacted by Jon Sterling, Astra Kolomatskaia, effectfully and Szumi Xie
SSet/--two-level is a red herring; Here's one that uses just paths.
{-# OPTIONS --cubical --safe #-}moduleripleywhereopen importAgda.Builtin.Cubical.Pathopen importAgda.Primitive.Cubicalopen importAgda.PrimitivedataBool:Setwherett ff : Bool
module_ (p : IsOne i0) wheremodule_ (theₛ :∀ {ℓ} {A :Set ℓ} → Partial i0 A → A) wheref : Partial i0 Bool
f =λ _ → tt
g : Partial i0 Bool
g =λ _ → ff
h : (theₛ f) ≡ (theₛ g)
h =λ i → theₛ f
i : tt ≡ ff
i = h λ f → f p
k : tt ≡ ff
k ={! i !}
Asking for the normal form of i gets me λ i₁ → tt.
Reacted by Jon Sterling, effectfully, Szumi Xie, Carlo Angiuli, Emily Pillmore, Scott Olson, Jason Carr, Tesla Zhang and Trebor Huang
Very nicely done @plt-amy! For the benefit of the Agda devs, let me comment a bit on how cooltt/redtt were carefully designed to avoid failures of subject reduction like this. I hadn't predicted this issue in particular, but there were other similar problems that I predicted and was careful to avoid in my design of cooltt and redtt.
In our tools, we have a syntactic phase distinction between cubical things (dimensions, cofibrations, proofs of cofibrations) and non-cubical things. In particular, this means that you cannot ever write something like nat -> I or Path A a b -> IsOne i0. This obviously has some downsides for expressivity, but it has one upside that has always been non-negotiable to me --- and which the evidence presented by this ticket suggests should also be non-negotiable to any implementer of cubical type theory. This upside is that you can always decide whether the current context is "judgmentally inconsistent"; it is then trivial to avoid the failure of subject reduction exhibited here, since k = refl would actually be well-typed in any context in which there can be derived some p : IsOne i0. (In such a context, all judgments hold.)
This particular benefit is a special case of the way that this phase distinction allows us to have a generalization of 'equality reflection' for the cofibration logic, which I suppose might be referred to as 'truth reflection', without disrupting either decidability of critical global properties of the algorithmic typing rules such as subject reduction or transitivity of definitional equality.
cubicalCubical Agda paraphernalia: Paths, Glue, partial elements, hcomp, transpsubject reductionIf you look away, this issue will reduce to a term with a different typetype: bugIssues and pull requests about actual bugs
Activity
jonsterling commentedon Aug 10, 2022
plt-amy commentedon Aug 10, 2022
Oh, of course!
[edit: updated the issue post instead]
plt-amy commentedon Aug 10, 2022
SSet/--two-levelis a red herring; Here's one that uses just paths.Asking for the normal form of
igets meλ i₁ → tt.jonsterling commentedon Aug 11, 2022
Very nicely done @plt-amy! For the benefit of the Agda devs, let me comment a bit on how
cooltt/redttwere carefully designed to avoid failures of subject reduction like this. I hadn't predicted this issue in particular, but there were other similar problems that I predicted and was careful to avoid in my design ofcoolttandredtt.In our tools, we have a syntactic phase distinction between cubical things (dimensions, cofibrations, proofs of cofibrations) and non-cubical things. In particular, this means that you cannot ever write something like
nat -> IorPath A a b -> IsOne i0. This obviously has some downsides for expressivity, but it has one upside that has always been non-negotiable to me --- and which the evidence presented by this ticket suggests should also be non-negotiable to any implementer of cubical type theory. This upside is that you can always decide whether the current context is "judgmentally inconsistent"; it is then trivial to avoid the failure of subject reduction exhibited here, sincek = reflwould actually be well-typed in any context in which there can be derived somep : IsOne i0. (In such a context, all judgments hold.)This particular benefit is a special case of the way that this phase distinction allows us to have a generalization of 'equality reflection' for the cofibration logic, which I suppose might be referred to as 'truth reflection', without disrupting either decidability of critical global properties of the algorithmic typing rules such as subject reduction or transitivity of definitional equality.
https://github.com/agda/agda/issues/6016