Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Universe Polymorphic Relations

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Universe Polymorphic Relations


Chronological Thread 
  • From: Gregory Malecha <gmalecha AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Universe Polymorphic Relations
  • Date: Wed, 23 Dec 2015 11:16:28 -0800
  • Authentication-results: mail3-smtp-sop.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-yk0-f172.google.com
  • Ironport-phdr: 9a23:39tn5BHJWniJkwQUial32Z1GYnF86YWxBRYc798ds5kLTJ75ociwAkXT6L1XgUPTWs2DsrQf27SQ6/iocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC0YLvj6ibwN76XUZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu5blitCLFOXmAvgtI/rpMYwuwwZgf8q9tZBXKPmZOx4COUAVHV1e1wysebsrFHoSRaFri8XVXxTmR5VCSDE6gv7V9H/qH2pmPB63Xy1J8D5SqolERGr66pgSBag3CgCPjo0+2HeosN1haNf5hmmokoskMbvfIiJOa8mLevmdtQASD8EB54JWg==

It looks like I spoke a bit too soon. What do I need to include in order to make it work with [reflexivity]?

Require Import Setoid.
Require Import Coq.Classes.CRelationClasses.

Set Printing Universes.

Polymorphic Class ILogic@{U X} (T : Type@{U}) : Type :=
{ lentails : T -> T -> Prop
; Refl_lentails :> Reflexive@{U X} lentails }.

Existing Instance Refl_lentails.
Print ILogic.


Section foo.
  Universe U T.
  Variable T : Type@{T}.
  Variable ILT : ILogic@{T U} T.
  Existing Instance ILT.
  Goal forall x : T, lentails x x.
        intros.
        reflexivity.
  (* Error: Tactic failure:  The relation lentails@{T
U} is not a declared reflexive relation. Maybe you need to require the Setoid library.
   *)
  eapply Refl_lentails. (* WORKS *)

Is this a bug with [eauto] and universe polymorphic lemmas?


On Wed, Dec 23, 2015 at 11:09 AM, Gregory Malecha <gmalecha AT gmail.com> wrote:
Yup. I believe that is what I'm looking for. Unfortunately, the online documentation does not show universes, so it pretty much looks the same as RelationClasses. ;-)

Thanks.

On Wed, Dec 23, 2015 at 10:52 AM, Jason Gross <jasongross9 AT gmail.com> wrote:
I think you are looking for Coq.Classes.CRelationClasses.

On Wed, Dec 23, 2015 at 12:50 PM, Gregory Malecha <gmalecha AT gmail.com> wrote:
Hello --

I'm wondering if there are definitions analagous to [Reflexive] and [Transitive] that are both universe polymorphic and work with the built-in tactics such as [reflexivity] and setoid rewriting. In particular, I note that when I use the basic definitions I get a universe constraint that I would like to avoid. For example,

Require Import Coq.Classes.RelationClasses.

Set Printing Universes.

Polymorphic Class ILogic (T : Type) : Type :=
{ lentails : T -> T -> Prop
; Refl_lentails : Reflexive lentails }.

Print ILogic.
(*
Polymorphic Record ILogic (T : Type@{Top.1}) : Type@{max(Set+1, Top.1)}
  := Build_ILogic
  { lentails : T -> T -> Prop;  Refl_lentails : Reflexive lentails }
(* Top.1 |= Top.1 <= Coq.Classes.RelationClasses.1
             *)
*)

The extra constraint [Top.1 <= Coq.Classes.RelationClasses.1] makes this definition less useful in my particular context. If I inline the definition of [Reflexive] then everything works out.

Polymorphic Class ILogic' (T : Type) : Type :=
{ lentails' : T -> T -> Prop
; Refl_lentails' :> forall a : T, lentails' a a }.

Print ILogic'.
(*
Polymorphic Record ILogic' (T : Type@{Top.12}) : Type@{max(Set+1, Top.12)}
  := Build_ILogic'
  { lentails' : T -> T -> Prop;  Refl_lentails' : forall a : T, lentails' a a }
(* Top.12 |=  *)
*)

However, with this definition, [reflexivity] does not work. I'm wondering if there already exists polymorphic instances of the basic classes, e.g. [Reflexive], [Transitive], [Proper], [Respectful], etc, or if there is some way to tell Coq to look for instances of a polymorphic version of these classes that I would define.

Thanks so much.

--
gregory malecha




--
gregory malecha



--
gregory malecha



Archive powered by MHonArc 2.6.18.

Top of Page