Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coe of V #90

Merged
merged 9 commits into from
Jun 14, 2018
Merged

coe of V #90

merged 9 commits into from
Jun 14, 2018

Conversation

favonia
Copy link
Collaborator

@favonia favonia commented Jun 11, 2018

Fix #42. The current code is actually incorrect---the 0/1 cases only make sense when x=y in x.V_y(...).

What is the immortal way to have alternative dynamics? @jonsterling

@favonia favonia self-assigned this Jun 11, 2018
@jonsterling
Copy link
Collaborator

@favonia Good catch!

Can you explain what you mean by your question though?

@favonia
Copy link
Collaborator Author

favonia commented Jun 11, 2018

What is the best way to have multiple implementations of Kan operations in redtt?

@jonsterling
Copy link
Collaborator

@favonia Ahh, I see... Right now we don't have any infrastructure for propagating settings or flags through the program state. I guess you could just set a flag as a reference somewhere, not sure what's best.

@favonia
Copy link
Collaborator Author

favonia commented Jun 11, 2018

Anyways, I want to implement both @mortberg's new version and what's in my private note.

@cangiuli
Copy link
Collaborator

Ultimately I dream of a user-exposed flag for ghcom/validity vs anything-goes composition, but this is very low priority until things are up and running.

@favonia favonia force-pushed the coe-of-V branch 4 times, most recently from dc48beb to 4ca1f55 Compare June 13, 2018 22:28
src/lib/Val.ml Outdated
make_hcom (Star.make D.dim1 (D.named y)) ty cap msys
in
let el0, face_front =
let mode = `SPLIT_COERCION in (* how should we switch this? *)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#94.

src/lib/Val.ml Outdated
match mode with
| `SPLIT_COERCION ->
begin
match D.unleash r (* favonia: is this really okay?! *) with
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonsterling Is this really okay?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a tiny it worried about it, but let me double check it; it kind of depends on how unleash is implemented whether this makes any sense.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@favonia This code is probably not going to do the right thing; instead, I think you should pattern match on the result of DimGeneric.make r, and in the Ok case, use the DimGeneric.atom operation that I have just now added.

@favonia favonia requested a review from jonsterling June 13, 2018 23:35
@favonia favonia added bug Something isn't working enhancement New feature or request labels Jun 13, 2018
@favonia
Copy link
Collaborator Author

favonia commented Jun 14, 2018

@mortberg Perhaps you can clearly see why I still did not give up the split-then-coercion version. The only differences are in el0 and face_front. You can see the splitting version seems more efficient if the Kan operations of sigma types are fully expanded (which seems to be necessary in redtt @jonsterling).

src/lib/Val.ml Outdated
el0, face_front
end
| `UNIFORM_HCOM ->
(* favonia: because there is no (easy) way to generate Sg in the semanitc domain,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can show you a trick I learned from @mortberg to do this 😉

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, I'm not sure exactly what you are referring to... But I bet it's a brilliant idea :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trick is to write the term in the term language / syntax with some free variables, and then evaluate it in an environment that has the things you want to dump into there. I think there is an example of doing this somewhere in the code (I did this for equivalences)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right! That is neat indeed :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I thought we do not have to bow to the darkness... @jonsterling Is there a helper function to create a good old variable from a string? I am worried about messing up with spine/cmd/head.

src/lib/Val.ml Outdated
match mode with
| `SPLIT_COERCION ->
begin
match D.unleash r (* favonia: is this really okay?! *) with
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@favonia This code is probably not going to do the right thing; instead, I think you should pattern match on the result of DimGeneric.make r, and in the Ok case, use the DimGeneric.atom operation that I have just now added.

src/lib/Val.ml Outdated
in
(el0 D.dim1, face_front)
| `UNICORN ->
failwith "too immortal; not suitable for mortal beings"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@favonia favonia requested a review from jonsterling June 14, 2018 16:52
Copy link
Collaborator

@jonsterling jonsterling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your code is looking nice! I'm obviously very happy to be trusting you about the details of the coe algorithm(s) implemented here.

let fiber0_ty b =
let var i = Tm.up @@ Tm.var i `Only in
eval (R.emp ()) [Val ty00; Val ty10; Val (car equiv0); Val b] @@
Tm.Macro.fiber (var 0) (var 1) (var 2) (var 3)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nicely done 😄

@favonia
Copy link
Collaborator Author

favonia commented Jun 14, 2018

@jonsterling Thanks, but I think your trust is misplaced---I only trust myself in creating bugs. 🤣 (Wait, what if the bug I created has a bug in itself that makes it a non-bug?)

@favonia favonia merged commit a7301fc into master Jun 14, 2018
@favonia favonia deleted the coe-of-V branch June 14, 2018 17:06
@jonsterling
Copy link
Collaborator

@favonia It's like Dr McCoy explained to Spock in "Star Trek IV: The Voyage Home"

It means that he is more confident in your guesses than he is in most people's facts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coe in V
4 participants