Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Canonical Structures and Coercions?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Canonical Structures and Coercions?


Chronological Thread 
  • From: Gregory Malecha <gmalecha AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Canonical Structures and Coercions?
  • Date: Sat, 29 Feb 2020 11:26:46 -0500
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gmalecha AT gmail.com; spf=Pass smtp.mailfrom=gmalecha AT gmail.com; spf=None smtp.helo=postmaster AT mail-wr1-f48.google.com
  • Ironport-phdr: 9a23:QmZnYxIWFbSQ1T+rvNmcpTZWNBhigK39O0sv0rFitYgeLvzxwZ3uMQTl6Ol3ixeRBMOHsq4C0rKO+PCxEUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba59IRmssAndqtUajYRhJ6s11xDEvmZGd+NKyGxnIl6egwzy7dqq8p559CRQtfMh98peXqj/Yq81U79WAik4Pm4s/MHkugXNQgWJ5nsHT2UZiQFIDBTf7BH7RZj+rC33vfdg1SaAPM32Sbc0WSm+76puVRTlhjsLOyI//WrKkcF7kr5Vrwy9qBx+247UYZ+aNPxifqPGYNgWQXNNUttNWyBdB4+xaYwAAfccPeZDt4nyuUcBrQewCwmrAePg0D5Ihnnr1qE+3OksFQTK0Qo9FNwMrXvUts34O6gcUe+3zKfGwzbNYe5I1zjh84XHaAwtrOuWUL5sbcbcy08iHB7FgFWKrozlOiuY2OUXs2eF4OpgUvivim46oA92uDevwtkjhZXJho0P11vJ8ip5wIMvKt28VkF0fd6kH4FLuiGVMot5WMIiQ2VytCkmzb0GvIe2cS4Xw5opwB7fbuaIc4mO4h/7W+aRICt4hHJ4eL2knRqy8E+gx+vhXce3yFZHtjRJnsXIu3wX1BHe6tKLRuVj8ku8wzqC2APe5+dZKk4uj6XbMYQuwrsom5oTr0vDGij2lV3zjKCMd0Uk/vGk6ur9Yrn7v5OcOYB5hwLkPqQhncy/Bus4MgwQUGSB5eu807jj8VX4QLVMkPI2jrHUvI7GKckfvKK0AA9Y3pw95xqhEjuqytsVkHofIFJAYh2HjozpO1/UIPD/CPeym1uskDJxyPDCILLuHpXNIWLYnbfueLZy8U9cyA4pwd9D4JJUD6kNIOjvVU/pqNzYEhg5PhSozObgEdVxz58RWWaSAqCCK67Sql+J5uc3I+aWfoMVuTD9K+Ik5/H0l3M5l0UdLuGV2s48b2nwNfB7KQ3Nan31x9wFDG0ivwwkTeWshkfUAhBJYHPncLgx6TYhGcqDBIPOTYCkyOiO2S6/E5ZWb0hJD1mNFTHjcIDSCKREUz6bPsI0ym9MbrOmUYJ0kEz37V6o+/9cNuPRvxYgm9fm3dlx6ffUkEhrpzNxBsWZlWqKSjMtxz9ad3oNxKl65HdF5BKby6Eh2q5XENVS47VCVQJobceBndw/MMj7X0f6RvnMSFuiRY/7UzQ4T9Z03MVXJkghS5OtiRfM2yfsCLgQxeSG

Hello --

It makes sense that it increases the size of the search space for CS. It sounds like the answer is that it isn't possible, and that the correct thing to do is to write all of the instances that you need.

Thanks.

On Sat, Feb 29, 2020 at 11:07 AM Beta Ziliani <beta AT mpi-sws.org> wrote:
Sounds like that would bloat the search space of CS. In this case is obvious, but how do you foresee if you need some coercion (and which one!)?

Written from mobile. Excuse my limited communication.

On Sat, Feb 29, 2020, 11:39 AM Gregory Malecha <gmalecha AT gmail.com> wrote:
Hello --

Is there a way to get canonical structures and coercions to work together? Here's my toy example:

Structure EX : Type :=
{ t :> Type
; GET : t -> Prop }.

Definition foo {e : EX} := e.(GET).

Canonical Structure TrueEX : EX :=
  {| GET := fun _ : bool => true |}.

Definition to_bool (n : nat) :=
  match n with
  | 0 => false
  | _ => true
  end.

Coercion to_bool : nat >-> bool.

Check (foo true). (* works great! *)
Check (foo 1).    (* fails *)

Intuitively, I would expect the term [@foo boolEX (to_bool 1)] but instead I get a type error "the term 1 has type nat while it is expected to have type EX".

Is there some way to make this work without making instances for, e.g. [natEX], which is the composition of [to_bool] and [foo]?

Thanks.

--
gregory malecha


--
gregory malecha



Archive powered by MHonArc 2.6.18.

Top of Page