[Agda] separate definition of constructors?

Jon Sterling jon at jonmsterling.com
Fri May 24 18:58:13 CEST 2019


Wow this is really cool, thanks for sharing Ambrus! I tried to experiment with something like this but got kind of owned in the process.

Best,
Jon


On Fri, May 24, 2019, at 10:16 AM, Ambrus Kaposi wrote:
> Hi Thorsten,
> 
> There is another workaround discovered recently by Szumi Xie: you can
> reduce any inductive-inductive type to one with only two sorts (using
> essentially the same technique as reducing mutual inductive types to
> an indexed inductive type). Then you can specify the constructors all
> at once. Here is Szumi's implementation of tt-in-tt using cubical:
> https://bitbucket.org/szumixie/tt-in-tt/src/master/Cubical/Syntax.agda
> 
> Cheers,
> Ambrus
> 
> On Fri, May 24, 2019 at 4:06 PM Thorsten Altenkirch
> <Thorsten.Altenkirch at nottingham.ac.uk> wrote:
> >
> > Hi,
> >
> >
> >
> > I am trying to port the definition of Type Theory in Type Theory form our paper
> >
> > Type theory in type theory using quotient inductive types. POPL 2016
> >
> > to cubical agda (yes I know inductive families don’t yet work but Andrea is working on it).
> >
> >
> >
> > However, when we faked this we were able to first introduce the point constructors and then the equality constructors but when doing this in cubical agda all the constructors have to appear together. This leads to the old problem that you have to create forward references for contructors which is a bit ugly. E.g.
> >
> >
> >
> > data Con : Set
> >
> > data Ty : (Γ : Con) → Set
> >
> > data Tm : (Γ : Con)(A : Ty Γ) → Set
> >
> > data Tms : (Γ Δ : Con) → Set
> >
> >
> >
> > data Ty where
> >
> >     _[_] : Ty Δ → Tms Γ Δ → Ty Γ
> >
> >
> >
> > data Tms where
> >
> >       id    : Tms Γ Γ
> >
> >       _,_  : (σ : Tms Γ Δ) → Tm Γ (A [ σ ]) → Tms Γ (Δ , A)
> >
> >
> >
> > data Ty where
> >
> >     [id]T : ∀{Γ}{A : Ty Γ} → A [ id ] ≡ A
> >
> >
> >
> > The problem is that Tms uses  _[_] hence I have to declare the point constructors for Ty first, but then the equality for Ty refers to id!
> >
> >
> >
> > This is an old issue (already with inductive-inductive definitions) but it gets worse once we have QIITs. There is a workaround to define a forward definition
> >
> >
> >
> > id'    : Tms Γ Γ
> >
> >
> >
> > and then use id’ in the equation for Ty and define later
> >
> >
> >
> > id' = id
> >
> >
> >
> > but this is a bit ugly. Would it be possible to allow separate definitions of constructors?
> >
> >
> >
> > Thorsten
> >
> > This message and any attachment are intended solely for the addressee
> > and may contain confidential information. If you have received this
> > message in error, please contact the sender and delete the email and
> > attachment.
> >
> > Any views or opinions expressed by the author of this email do not
> > necessarily reflect the views of the University of Nottingham. Email
> > communications with the University of Nottingham may be monitored
> > where permitted by law.
> >
> >
> >
> _______________________________________________
> Agda mailing list
> Agda at lists.chalmers.se
> https://lists.chalmers.se/mailman/listinfo/agda
>


More information about the Agda mailing list