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: "jonikelee AT gmail.com" <jonikelee AT gmail.com>
- To: Jason Gross <jasongross9 AT gmail.com>
- Cc: coq-club AT inria.fr, 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 23:26:57 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qv1-f47.google.com
- Ironport-phdr: 9a23:wrE5aRPxr/qRwlBXuYAl6mtUPXoX/o7sNwtQ0KIMzox0I/n6rarrMEGX3/hxlliBBdydt6sVzbaH+P6xEUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCe5bL9oIxi7qQrdu8gSjIB/Nqs/1xzFr2dSde9L321oP1WTnxj95se04pFu9jlbtuwi+cBdT6j0Zrw0QrNEAjsoNWA1/9DrugLYTQST/HscU34ZnQRODgPY8Rz1RJbxsi/9tupgxCmXOND9QL4oVTi+6apgVQTlgzkbOTEn7G7Xi9RwjKNFrxKnuxx/2JPfbIWMOPZjYq/RYdYWSGxcVchTSiNBGJuxYYUPAeQfIOhWrIvyp1UJoxSxGQaiC/jiyiNRhnLswaE3yfgtHAPA0Qc9H9wOqnPUrNDtOascU+C1y6/IzTTAb/xI3Tfy9pbHfwsuofGJR71wcM7RxVMzGAPCi1Wcp5HuMjSX1uQKtWib7ulgWvyri2E5tQ58uTevxsI2hYnIgoIZ0EzL9SJ8wIssI9CzVUF0b8K+HpRKqyGaK5V5QtkkQ2xwpCs21L8LtJGlcSUIyZkpyR7RZuCHfoWM/B/uVficLCp4iX55Zb6yhgi+/Fa9x+DiWcS4zEhHoCRZn9TPsn0A1xre4dWERPtl5kqtxyqD2gTJ5uxHIU04j7TXJ4Mlz7IqmZces1zPEjH3lUnqkaObc1go9+y05Onibbjrp4OQO5NxhwzwMKkihMmyDvkkPQUAXGWW/Pmz1LPt/U33RbhKgOM5nrXHvJ3fKskXuKC0DBNT340+8RiwFS2m384dnXQfLFJKZhaHj4/xNlHLOv/4DPO/j021kDd12vzKJ7PhD5rPI3TZn7fherF960FYyAUt19xQ+5VUCrQZLPLyXE/+qsDYAwcnPwCox+vrEtZw24MEVW6RH6OUNLnevFCK6+43JumDfo4VuDLzK/g/4P7uiGc0mV0afamv3JsXa263HvB4LEqHenfsjdIBHn0Lvgo6VuDllFqCUTtLa3aoQ608/i07CJ6hDYrbWo+th6WB0D6nEZ1Se2BJEUuBEWzodoWBQ/cDcjieIs5nkjweVLiuUZUt1R+0tFyy970yDOPP/StQmojkz8M9s+/ajhY0+iZzFN/M+26IRmBw2GgPQmll8rp4pBk3yFCF0Kt1h/FVPdNW7vJNFAw9MNSUm+59DdHxVwbMc/+GTV+nRpOtBjRnHYF5+MMHf0soQ4bqtRvExSf/RuZNz+XaVqxxybrV2j3KH+g4zn/H0Kc7iFx/G5lAMGSnguh08A2BXteVwXXcrL6jcOEn5ACI7H2KlDPcs0RRUQo2WqLADyhGOxnm6O/h70aHdIeATLQqNgwblJyHI6pOL8T31BBIGKilN9PZbGa83Wy3AETQyw==
On Sat, 6 Feb 2021 22:32:25 -0500
Jason Gross <jasongross9 AT gmail.com> wrote:
> 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.)
That's a good point, actually two. So, to start:
Ltac issubtype A B :=
first [let _:=constr:(B:A) in fail 1 B "can be ∈" A
|let _:=constr:((fun x=>x):(A->B)) in idtac
|fail 1 A "and" B "are constrained to be unrelated"
].
The id fun check you suggest makes the constr_eq_strict check
redundant. Which is good, as I am hitting universe bugs with
constr_eq_strict. I don't need the assert_succeeds - actually don't
think I ever did.
For the checking for coercions part - I guess I need to parse that
constr to see if the function's body is just x or not. This might work:
Ltac issubtype A B :=
first [let _:=constr:(B:A) in fail 1 B "can be ∈" A
|lazymatch constr:((fun x=>x):(A->B)) with
| fun x => x => idtac
end
|fail 1 A "and" B "are constrained to be unrelated"
].
But, the existence of a coercion doesn't mean A isn't a subtype of B,
just that it might not be - admittedly, it probably isn't, else why
need a coercion? Also, coercions between sorts (other than
something like inhabited:Type->Prop) seem very unlikely. Still a
little troubling...
- [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+.