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: Jonathan <jonikelee AT gmail.com>
- Cc: coq-club <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: Sun, 7 Feb 2021 07:14:51 -0500
- Authentication-results: mail3-smtp-sop.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-f41.google.com
- Ironport-phdr: 9a23:23weVBKXlgxz20gTxtmcpTZWNBhigK39O0sv0rFitYgeLvrxwZ3uMQTl6Ol3ixeRBMOHsqMC1rOd6/qocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmT6wbalyIRmrogndqtcaipZ+J6gszRfEvmFGcPlMy2NyIlKTkRf85sOu85Nm7i9dpfEv+dNeXKvjZ6g3QqBWAzogM2Au+c3krgLDQheV5nsdSWoZjBxFCBXY4R7gX5fxtiz6tvdh2CSfIMb7Q6w4VSik4qx2UxLjljsJOCAl/2HWksxwjbxUoBS9pxxk3oXYZJiZOOdicq/BeN8XQ3dKUMRMWCxbGo6zYIUPAOgBM+hWrIfzukUAogelCAa2GO/i0CVFimPq0aA41ekqDAHI3BYnH9ILqHnaqM/6NLwVUeCz0aLGzC/Db/RN2Tfm9YPFdRIhruuXXbJ3d8rRxlMvFwTejlWLrYHoJDyV1uEXvGia6+psT/6gi2kiqwxopDWk28gjhJXTiI0P1lDE6Tt2wJwzJdCgSkN2Y8KpHZpfuiyYNoZ7Xt8vT3xotSs+zrALuoC2cicIxZop2hPSaPiKf5aI7B/9VOicISp0iXx4dL++mxq//k6twfD/WMmsyFtGsDZJn93Wun0O1xHf8NWLR/p880u71juDygbe4fxeL08uj6rUMZshz6YwlpUNtUTDGTf7mEDsg6+XckUo4+mo6+P6brn/qJ+ROJJ4hhvxMqQpncy/DuA4PRYUU2eH/uS80aXv/Uz/QLpUkv07irfVvIzeKMgBpaO0AxVZ3psi5hu+FTur38kUkWECLF1feRKHi4bpO0vJIPD9Ffq/gU6jkCxsx/DAMb3hGJLNLmPYkLrlZrt95EtcxxAyzdBb/Z5bFrYBIPfrVk/rqNPYFgM5MxCzw+v/FNp90ZoeVXuTDa+dLaPdqkSF5vkvIumJfI8aoizxK/kj5/70jH82g0URfaez3chfVHftPPNgKlmZaHyk1tUGF2YJsw4zQcTljVSDVXhYYHPkDIwm4TRuKou9CoGLaZqqm6fJiCWyBZpQaXpBEUvdOXjtfoSAHfwLbXTBcYdajjUYWO35GMca3ha0uVq/kuI/d7uGymgjrZvmkeNNyajWnBA2+yZzCp3EgW6IRmBw2GgPQm1vhfwtkQlG0l6GlJNArblAD9UKvqFGVw47MdjXyOkoU4mvCDKERc+ATROdevvjATw1SYhskdoHYkI4GtL7yx6fhmylBLgak7HND5sxoPrR
I think your check is backwards (admittedly, I gave it to you backwards); you want B -> A for "A is a subtype of B". Also, even the corrected tactic gives the wrong answer on checking if Set is a subtype of Prop. Why do you need the element-of check?
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+.