coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?
Chronological Thread
- From: Jason Gross <jasongross9 AT gmail.com>
- To: coq-club <coq-club AT inria.fr>
- Cc: Pierre Courtieu <pierre.courtieu AT gmail.com>
- Subject: Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?
- Date: Sat, 6 Feb 2021 22:32:25 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-io1-f43.google.com
- Ironport-phdr: 9a23:1hZb/hEMf/gDtp7a1wiYTJ1GYnF86YWxBRYc798ds5kLTJ7zo8iwAkXT6L1XgUPTWs2DsrQY0ruQ7/GrBD1IyK3CmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+KPjrFY7OlcS30P2594HObwlSizexfLd/IA+5oAjVucUbgY9vIbstxxXUpXdFZ/5Yzn5yK1KJmBb86Maw/Jp9/ClVpvks6c1OX7jkcqohVbBXAygoPG4z5M3wqBnMVhCP6WcGUmUXiRVHHQ7I5wznU5jrsyv6su192DSGPcDzULs5Vyiu47ttRRT1kyoMKSI3/3/LhcxxlKJboQyupxpjw47PfYqZMONycr7Bcd8GQGZMWNtaWS5cDYOmd4YAAOQBMuRYoYfzpFUAsAWwChW3Cez11jNFnGX70bEm3+kjFwzNwQwuH8gJsHTRtNj7ML0dUfuyzKnO0D7NbulW2TDm6IjTbxsspvOMUqhrccrWz0kvGBnFjlKLqYz+Oz6YzesNs22B4OphUeKjkXIoqwZ0ojW2wMonl4bGiJ4PxF/e6SV53Jg6Jce+SENjY9OpEodduiCVOoZ0Q84vX31ltDs6x7ACvZO2fzYHxpslyhDRdvGKcIyF7gzjWuuPITl1hG9pdbyiixuz7UStxevxXdS33lZStidJjMXAu3QX2xHQ6sWLUOZx80ag1DqV2A3e5OdJKl0um6XBMZ4u2Lswm4ITsUvdGi/2n137jKqMeUUl/uik8uXnYrL7qpOFOY95hQ/zPr4hmsy4BuQ4PQwOUHaB9eug073j+FX1QLRMjvIojqnUqI7WKdgfq6KjAAJY0pwv5wu+AjqnytgVkncKIEpAeB2djojpP1/OIOr/Dfe6m1mski1kx+vBPr3nDZXNNH/DkKz6fbt58ENcxw8zwspe55JQEL0OPPXzWkrpuNzCEhA5KxC0w/rgCNhlyoweXnuPDraFP6PWrF+H/fkiI/KMZY8QoDbyMeIp5//ojX8jmF8SZ7Ol3ZUNaCPwIvMzKEKAJHHon91JRWwNp081SPHgoFyESz9aIXioCfES/DY+XaCvFoDFDq+3h6ealHO5F4ZRYG9cDUuXQF/ncoyFX7EHbyfEcZwpqSANSbX0E9xp7hqprgKvjuM/drOFqB1djorq0Z1O38OWkBgz8TJuCMHEijOCSmh1miUDQDpkhfkj83w48U+K1O1Du9IdDcZavqobXQIzNJqaxOt/WYirB1DxO+yRQVPjee2IRDE8StVrno0Lakd5XtSl11XNg3HsDLgSmLiGQpcz9/CE0g==
For subtype, can't you just check whether or not (fun x : A => (x : B)) typechecks? This seems to me to be the definition of B being a subtype of A. (Of course, this will insert coercions, so maybe you also want to check that no coercions are inserted.)
On Sat, 6 Feb 2021 11:06:58 +0100
Pierre Courtieu <pierre.courtieu AT gmail.com> wrote:
> Hi Jonathan
> Nice trick. I never realized that I was creating new constraints by
> doing this carelessly.
> P
Unfortunately, it doesn't quite work either. The issue with:
Ltac issubtype A B :=
first [constr_eq_strict A B
|let _:=constr:(B:A) in fail 1 B "can be <=" A
|assert_succeeds (let _:=constr:(A:B) in idtac)
|fail 1 A "and" B "are constrained to be unrelated"
].
is that if A is in Type then A might be a sort or a type. Unfortunately
there is no way for the tactic to know which it is going to be - and
issubtype's "(B:A)" test only works to filter out bad cases if A is
clearly a sort (when B is at least a type, possibly a sort).
For instance:
Definition test@{i j}(X:Type@{i})(Y:Type@{j}) : True.
Proof.
issubtype X Type@{j}. (*does not fail, but I want it to fail*)
Maybe the necessary trick is to first check if issubtype (type of A)
(type of B) - and only if this passes check issubtype A B:
let tA:=type of A in
let tB:=type of B in
issubtype tA tB; isssubtype A B.
Or, actually, I don't think I need that final issubtype A B check as
issubtype tA tB is conclusive...?
- [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/05/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/05/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/05/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, Pierre Courtieu, 02/06/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/07/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, Jason Gross, 02/07/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/07/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, Jason Gross, 02/07/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/07/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/07/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/07/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, Jason Gross, 02/07/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/07/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, Pierre Courtieu, 02/06/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/05/2021
- Re: [Coq-Club] Puzzle: tactic that can check Sort subtyping without adding universe constraints?, jonikelee AT gmail.com, 02/05/2021
Archive powered by MHonArc 2.6.19+.