[Agda] separate definition of constructors?

Jon Sterling jon at jonmsterling.com
Sat Jun 1 01:49:51 CEST 2019


That'd be really useful to me!!
Best,
Jon


On Fri, May 31, 2019, at 2:32 PM, James Chapman wrote:
> This sounds good. We discussed this at AIM (insert roman numeral) when 
> implementing the declare before use version of mutual definitions but 
> one barrier was thinking of a sensible syntax for isolated constructor 
> declarations.
> 
> I would like to have complete freedom to interleave constructors and 
> function clauses. 
> 
> Sometimes you need to be able to run one function clause to type check 
> the next clause of the same function etc. I am not sure if the existing 
> setup supports that.
> 
> James
> 
> On Thu, 30 May 2019 at 13:17, Thorsten Altenkirch 
> <Thorsten.Altenkirch at nottingham.ac.uk> wrote:
> > Yes something like the constructor keyword could work (it needs to include a list of parameters, though). This would be a compatible change (you could still use the old syntax). What exactly would be the problem (apart from implementing it).
> > 
> >  Once you use QIITs in anger this is going to happen all the time.
> > 
> >  Thorsten
> > 
> >  On 30/05/2019, 11:39, "Agda on behalf of Guillaume Allais" <agda-bounces at lists.chalmers.se on behalf of guillaume.allais at ens-lyon.org> wrote:
> > 
> >  Hi Thorsten,
> > 
> >  The ability to interleave various definitions like we typically do in papers
> >  is something we would like to have. However there are some technical challenges
> >  related to the way mutual blocks are currently detected.
> > 
> >  Cf. https://github.com/agda/agda/issues/2858
> > 
> >  Cheers,
> >  --
> >  gallais
> > 
> >  On 30/05/2019 11:29, Thorsten Altenkirch wrote:
> >  > Thank you - this is a nice hack.
> >  > 
> >  > It does solve my problem but the question remains why this hack should be necessary. We should be able to declare the constructors for a collection of inductive types in any order. Would this be difficult to achieve?
> >  > 
> >  > Thorsten
> >  > 
> >  > On 24/05/2019, 17:18, "Kaposi Ambrus" <akaposi at inf.elte.hu> 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.
> >  > >
> >  > >
> >  > >
> >  > 
> >  > 
> >  > 
> >  > 
> >  > 
> >  > 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
> >  > 
> > 
> > 
> > 
> > 
> > 
> > 
> >  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
> _______________________________________________
> Agda mailing list
> Agda at lists.chalmers.se
> https://lists.chalmers.se/mailman/listinfo/agda
>


More information about the Agda mailing list