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

Added a primitive composition for Id types which reduces with refl on… #71

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

IanOrton
Copy link

… either side

-- [ (i = 0) -> <_> a
-- , (i = 1) -> <_> a
-- , (j = 0) -> <_> a
-- , (j = 1) -> <_> a ]) []
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation seems to be off by one here?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, this is a tabs vs spaces issue. They look aligned in my emacs buffer! Fixed now.

Copy link
Owner

Choose a reason for hiding this comment

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

And this is why one should never use tabs :)

-- refl
-- a -------> a
-- refId | | refId
-- . id1 | | . id2
Copy link
Contributor

Choose a reason for hiding this comment

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

I am again nitpicking, but I have a feeling that you want the dot . before id1 to be aligned with f.

@favonia
Copy link
Contributor

favonia commented Jun 14, 2017

Wow! I have to say that the accompanying file examples/idcomp.ctt is really impressive! (My comments were intended to further perfect the documentation, not to criticize it.)

Eval.hs Outdated
rs = unionSystem
(unionSystem
(border (q @@ (Atom i :/\: Atom j)) ps)
(border (p @@ (Atom i :/\: NegAtom j)) qs))
Copy link
Owner

@mortberg mortberg Jun 14, 2017

Choose a reason for hiding this comment

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

Shouldn't this be i \/ -j?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, now fixed

Eval.hs Outdated
idComp :: Val -> Val -> Val -> Val -> Val -> Val -> Val
idComp a u v w pId qId = case (pId, qId) of
(VIdPair p ps, qId) | eps `member` ps -> qId
(pId, VIdPair q qs) | eps `member` qs -> pId
Copy link
Owner

Choose a reason for hiding this comment

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

Are these two cases really needed? Isn't it possible to get the next case to cover them?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would guess @IanOrton just wanted to take some shortcuts here?

Copy link
Owner

Choose a reason for hiding this comment

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

They seem a little dangerous to me, and if I comment them out the examples doesn't go through (even if one fixes the bug I found).

Copy link
Author

Choose a reason for hiding this comment

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

Hmmm, I'm not sure. I think that they are needed to make sure that refl . p will reduce even when p is just a variable. To hit the other case you need to know that p is in fact a VIdPair. The behaviour should agree when the cases overlap so I've now moved these two cases after the third one. But maybe this behaviour is too strong? Do we want refl . p to reduce in the case when p is an undetermined variables of type Id A a b?

in
VIdPair (VPLam i (comp j a v rs)) (joinSystem (border ps qs))
(VIdPair p ps, qId) | eps `member` ps -> qId
(pId, VIdPair q qs) | eps `member` qs -> pId
Copy link
Owner

Choose a reason for hiding this comment

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

I'm still a bit unsure about these two reduction rules. It seems dangerous to add them, but I don't have any concrete evidence why.

@simhu : Maybe you have more thoughts about this?

Copy link
Author

Choose a reason for hiding this comment

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

As some justification, imagine that face formulae were first class objects and we could see that Id types were pairs of a path and a face formula. Then, using eta for pairs and paths, we would have:

idComp (<i> a , 1) qId
   = idComp (<i> a , 1) (qId.1 , qId.2)
   = (<i> comp j A [ 1 -> qId.1 @ (i /\ j) , qId.2 \/ (i=0) -> a ] a , 1 /\ qId.2)
   = (<i> qId.1 @ i , qId.2)
   = (qId.1 , qId.2)
   = qId

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants