quantify over universes in build iota - #904
Conversation
|
Hm, no. This is still not correct because lines 165 and 166 assume that |
|
Had the idea of adding but this fails on |
|
Edit: I found it, it was printing in my installed directory, |
|
So, this attempted fix fails because the clause is added to |
|
Okay. The function now works for I notice that Would it be better to modify the code to restrict the number of universes? I can't think of a situation where you would need the universes to be different. |
|
I think I have a decent idea of why it's happening. The I don't know how to fix this appropriately, but it seems important to fix this or there will be a proliferation of universes. |
|
Yes! I'm very happy with this. |
| Set Printing Universes. | ||
| Print T. | ||
| Print X. | ||
| Print op. |
There was a problem hiding this comment.
This is part of the reason why I suggested to make a copy of the file in apps/derive/.
I think it is worth writing some tests, eg about the universe-arity of the generated constants. I can imagine Universe X. Check f_expanded@{X}. or similar.
But the current file is a simple proof of concept and the main role of this file is to explain how to build rules, accumulate them, and implement a "global substitution" thingy.
I'm afraid I lack a decent POC using universes, so maybe the delta of this file can serve for that, dunno.
There was a problem hiding this comment.
I think it is worth writing some tests, eg about the universe-arity of the generated constants. I can imagine Universe X. Check f_expanded@{X}. or similar.
Is there some kind of expect-test for this? I don't know how to make it an actual test.
There was a problem hiding this comment.
This is part of the reason why I suggested to make a copy of the file in apps/derive/.
Yeah I agree. (Or it could be its own app, unbundle? is it better to group it in with derive?)
There was a problem hiding this comment.
The test above checks that f_expanded has only one universe quantification.
To ensure more I think you have to write something Definition test_f@{ u v | u < v} := f@{u v}. but I think you can only test an "upper bound" to the constraint set, not really that they are as you prescribe.
|
Okay. I have addressed the changes you suggested but I added another test (the identity |
|
I think I fixed the bug, but it could probably use more tests. Any further work I do on this will be in a different PR, in |
| if (coq.env.global (const C) (pglobal _ _ )) | ||
| (@univpoly! => coq.env.add-const Name NewBo _ _ NC) | ||
| (coq.env.add-const Name NewBo _ _ NC), |
There was a problem hiding this comment.
| if (coq.env.global (const C) (pglobal _ _ )) | |
| (@univpoly! => coq.env.add-const Name NewBo _ _ NC) | |
| (coq.env.add-const Name NewBo _ _ NC), | |
| if (coq.env.global (const C) (pglobal _ _ )) (FLAGS = @univpoly!) (FLAGS = true), | |
| FLAGS ==> coq.env.add-const Name NewBo _ _ NC, |
| expand-spine (info R _ _ Projs K as Info) (fun _ LTy Bo) Result AccL AccR Premises (pi r\ Clause r) :- coq.env.global (indt R) LTy, LTy = global _, !, | ||
| coq.env.indt R _ _ _ _ _ [KTY], |
There was a problem hiding this comment.
| expand-spine (info R _ _ Projs K as Info) (fun _ LTy Bo) Result AccL AccR Premises (pi r\ Clause r) :- coq.env.global (indt R) LTy, LTy = global _, !, | |
| coq.env.indt R _ _ _ _ _ [KTY], | |
| expand-spine (info R _ _ Projs K as Info) (fun _ (global (indt R)) Bo) Result AccL AccR Premises (pi r\ Clause r) :- !, | |
| coq.env.indt R _ _ _ _ _ [KTY], |
| expand-spine (info R _ _ Projs K as Info) (fun _ LTy Bo) Result AccL AccR Premises (pi r U\ Clause r U) :- | ||
| coq.env.global (indt R) LTy, LTy = pglobal _ UL , !, % U is a subset of the universes in the main term to be expanded. | ||
| (@uinstance! UL ==> coq.env.indt R _ _ _ _ _ [KTY]), % Be sure that K is instantiated with the same universe instance UL occurring in the binder LTy |
There was a problem hiding this comment.
| expand-spine (info R _ _ Projs K as Info) (fun _ LTy Bo) Result AccL AccR Premises (pi r U\ Clause r U) :- | |
| coq.env.global (indt R) LTy, LTy = pglobal _ UL , !, % U is a subset of the universes in the main term to be expanded. | |
| (@uinstance! UL ==> coq.env.indt R _ _ _ _ _ [KTY]), % Be sure that K is instantiated with the same universe instance UL occurring in the binder LTy | |
| expand-spine (info R _ _ Projs K as Info) (fun _ (pglobal (indt R) UL) Bo) Result AccL AccR Premises (pi r U\ Clause r U) :- !, % UL is a subset of the universes in the main term to be expanded. | |
| (@uinstance! UL ==> coq.env.indt R _ _ _ _ _ [KTY]), % Be sure that K is instantiated with the same universe instance UL occurring in the binder |
No description provided.