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
Proper support for inductive families in Cubical Agda #3733
It would be nice with proper support for inductive families in Cubical Agda. If I have understood correctly this is a non-trivial research problem, so I have put this issue in the icebox for now.
What is the current status of inductive families in Cubical Agda? I seem to recall @Saizan mentioning that they can break canonicity. What about consistency?
Reacted by G. Allais, Tesla Zhang, oliverbergq and Guilherme Silva
Inductive families shouldn't break consistency, as ``--without-K``` makes sure pattern matching is consistent with the indexing being up to a weak enough equality.
They indeed break canonicity as transp/hcomp do not compute for them, and pattern matching definitions will get stuck on those elements.
I've recently started working on this btw, so hopefully we get a full implementation not too late from now.
Reacted by Anders Mörtberg, WorldSEnder, Liang-Ting Chen, Vikraman Choudhury, Scott Olson, Dylan Ede, Martin Escardo, Tesla Zhang, Apostolis Xekoukoulotakis and oliverbergq
In my rather naive eyes, the following should define an equivalence, but currently does not due to getting stuck.
module _ {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} (f : A → B) where
open import Level
open import Cubical.Foundations.Everything
data Indexed : B → Set (ℓ Level.⊔ ℓ') where
⌜_⌝ : ∀ a → Indexed (f a)
fiber→Indexed : ∀ {b} → fiber f b → Indexed b
fiber→Indexed (a , fa≡b) = transport (λ i → Indexed (fa≡b i)) ⌜ a ⌝
Indexed→fiber : ∀ {b} → Indexed b → fiber f b
Indexed→fiber ⌜ a ⌝ = a , refl
The flag -vtc.def.fun.clauses:15 can be used to print out the final clauses for a function definition. And the flag -vtc.transpix.type:15 can be used to print out the type of generated constructor for transport on indexes.
Here we could just checkInternal the generated clauses, similarly to the type for with, or introduce more specific checks.
It seems to me as if it would not make sense to make the generated transpX constructors erased. Does it still make sense to erase them, and the generated clauses, when compiling using --erased-cubical?
The flag -vtc.def.fun.clauses:15 can be used to print out the final clauses for a function definition. And the flag -vtc.transpix.type:15 can be used to print out the type of generated constructor for transport on indexes.
The generated clauses are not looked at for other purposes that might benefit, like matching in the presence of @0.
Do you mean that we could accept more definitions? Currently we do not allow matching on erased arguments if the type is an inductive family (unless --with-K is active), so my guess is that the answer is "yes".
I don't follow this part. In the discussion of issue #4966 you wrote that "This kind of definition would be disallowed by the positivity checker once the extra clauses for issue #3733 get generated". Did you mean that there are "some false-proving definitions that will get rejected"?
Activity
Saizan commentedon Apr 30, 2019
Inductive families shouldn't break consistency, as ``--without-K``` makes sure pattern matching is consistent with the indexing being up to a weak enough equality.
They indeed break canonicity as transp/hcomp do not compute for them, and pattern matching definitions will get stuck on those elements.
I've recently started working on this btw, so hopefully we get a full implementation not too late from now.
WorldSEnder commentedon Jun 12, 2019
Any updates on this?
WorldSEnder commentedon Jun 13, 2019
In my rather naive eyes, the following should define an equivalence, but currently does not due to getting stuck.
I am wondering, is this understanding correct?
Saizan commentedon Sep 13, 2019
It's still provably an equivalence, by path induction/contractibility of singletons:
[ Re #3733 ] Generate transpIx
[ re #3733 ] defining trX-con cases and more
[ re #3733 ] fixed trX-trX clause generation
[ re #3733 ] trX-hcomp clauses
[ re #3733 ] only warn about missing equivs when --cubical.
ice1000 commentedon Mar 24, 2021
Is https://staff.math.su.se/anders.mortberg/papers/cubicalagda2.pdf (sec 3.2.4) a formalization of this work?
Saizan commentedon Mar 25, 2021
Yeah, that's it
7 remaining items
[ re #3733 ] tc.transpx.type:15 to print transpX type.
[ re #3733 ] fix test
Saizan commentedon Aug 23, 2021
Status Update: Merged partial support for inductive families into
master.Missing features and caveats:
@0.is mostly a matter of writing out the implementation.
is more problematic, because while it could lead to replacing the "masking" introduced in the fix to Coinduction incompatible with univalence [WAS: Structural termination order incompatible with univalence] #1023 it also seems to introduce its own distinct class of false positives, at least if applied naively.
However it also means that there's some false-proving definitions that will get accepted, like
--without-Kinconsistent with UA + LEM #4966 with UA and propositional LEM. Most likely others as well!The flag
-vtc.def.fun.clauses:15can be used to print out the final clauses for a function definition. And the flag-vtc.transpix.type:15can be used to print out the type of generated constructor for transport on indexes.with, or introduce more specific checks.nad commentedon Sep 28, 2021
It seems to me as if it would not make sense to make the generated
transpXconstructors erased. Does it still make sense to erase them, and the generated clauses, when compiling using--erased-cubical?Saizan commentedon Sep 28, 2021
We should have
|transpX p φ u| = |u|. The realizability lemma should go like the one forhcompconstructors of HITs.nad commentedon Oct 13, 2021
The second flag should be
-vtc.transpx.type:15.nad commentedon Nov 25, 2021
Do you mean that we could accept more definitions? Currently we do not allow matching on erased arguments if the type is an inductive family (unless
--with-Kis active), so my guess is that the answer is "yes".I don't follow this part. In the discussion of issue #4966 you wrote that "This kind of definition would be disallowed by the positivity checker once the extra clauses for issue #3733 get generated". Did you mean that there are "some false-proving definitions that will get rejected"?
Saizan commentedon Nov 25, 2021
Regarding 3., I meant what we later did for the fix of #5448.
The "However it also means ..." paragraph is talking about the current situation where the generated clauses are ignored.
Btw, as of commit ff2e436 the injectivity check has actually been handled.
[ #3733 ] Remove spurious module TC.Coverage.CoverResult
[ #3733 ] Remove spurious module TC.Coverage.CoverResult
ice1000 commentedon Apr 11, 2022
@Saizan is there any update on the cubicalagda2.pdf thing? Is it published now or is there an updated version?
Merge branch 'master' into aliao/transpix-docs, link to #3733
andreasabel commentedon Dec 7, 2024
The feature was merged in 621894f. This commit introduced regression
[Cubical] Constructor injectivity via orthogonal retract decompositio…
Merge pull request #1 from clearnature/fix/cubical-injectivity-retract