<div dir="ltr"><div>I guess most of the reasons why one would use a record type instead of a single-constructor datatype still apply:</div><div>- You get the projections for free</div><div>- You can define new elements using copatterns</div><div>- You can make the record coinductive if needed</div><div><br></div><div>-- Jesper<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 5, 2019 at 3:46 PM Andrew Pitts <<a href="mailto:andrew.pitts@cl.cam.ac.uk">andrew.pitts@cl.cam.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Dear Jesper,<br>
<div><br><blockquote type="cite"><div>On 5 Jun 2019, at 13:34, Jesper Cockx <<a href="mailto:Jesper@sikanda.be" target="_blank">Jesper@sikanda.be</a>> wrote:</div><br class="gmail-m_7757473178893307641Apple-interchange-newline"><div><div dir="ltr"><div>Hi Andy,</div><div><br></div><div>When you define a datatype in Prop, the resulting type is automatically 'squashed', i.e. any two elements are equal. In contrast, for record types this is not possible because then it is impossible to define the projections. For your definition of ∃ in Prop, (true , _) is equal to (false , _) of type `∃ Bool (λ _ → ⊤)`, but their first projections are not equal. It would theoretically be possible to have such a record type but not give access to the projections and disabling eta-equality, but then you could've equally defined it as a single-constructor datatype.</div></div></div></blockquote><div><br></div>I see. So to paraphrase your explanation, Agda imposes a simple syntactic restriction on what record types can be declared to have type Prop in order to maintain the soundness of forcing all elements of an element of a Prop to be definitionally equal.</div><div><br></div><div>I can think of a simple syntactic restriction that is less liberal than the current one: don’t allow record types in Prop! Is there an example of why my restriction is too restrictive? —- in other words a case where using a record of Prop type is really better than using a corresponding single-constructor datatype of type Prop?</div><div><br></div><div>(I am thinking that one often uses a record type in Set instead of a single-constructor-datatype in Set, in order to get definitional eta expansion; but that’s automatic for elements of Prop, due to the definitional proof irrelevance.)</div><div><br></div><div>Andy</div><div><div><br></div><br><blockquote type="cite"><div><div dir="ltr"><div><br></div><div>-- Jesper<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 5, 2019 at 1:09 PM Andrew Pitts <<a href="mailto:andrew.pitts@cl.cam.ac.uk" target="_blank">andrew.pitts@cl.cam.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Here is another question about Prop in Agda 2.6. Can anyone enlighten me?<br>
<br>
The documentation says<br>
<br>
"Just as for Set, we can define new types in Prop’s as data or record types”<br>
<br>
However, although Agda 2.6 allows the declaration of the following one-constructor datatype<br>
<br>
data ∃ {l m}(A : Set l)(P : A → Prop m) : Prop (l ⊔ m) where<br>
_,_ : (x : A)(p : P x) → ∃ A P<br>
<br>
if instead I try to define a record type<br>
<br>
record ∃ {l m : Level}(A : Set l)(B : A → Prop m) : Prop (l ⊔ m) where<br>
constructor _,_<br>
field<br>
fst : A<br>
snd : B fst<br>
<br>
Agda complains (somewhat ungrammatically) that <br>
<br>
"Set l is not less or equal than Prop (l ⊔ m) when checking the definition of ∃”<br>
<br>
So it doesn’t mind the parameter (A : Set l) when defining a datatype in Prop (l ⊔ m), but does mind it when defining a record type.<br>
<br>
Why is that?<br>
<br>
Andy<br>
<br>
<br>
_______________________________________________<br>
Agda mailing list<br>
<a href="mailto:Agda@lists.chalmers.se" target="_blank">Agda@lists.chalmers.se</a><br>
<a href="https://lists.chalmers.se/mailman/listinfo/agda" rel="noreferrer" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><br>
</blockquote></div>
</div></blockquote></div><br></div></blockquote></div>