[Agda] separate definition of constructors?

Thorsten Altenkirch Thorsten.Altenkirch at nottingham.ac.uk
Thu May 30 14:17:26 CEST 2019


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.






More information about the Agda mailing list