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

Constant square in redtt #239

Closed
mortberg opened this issue Aug 16, 2018 · 12 comments · Fixed by #245
Closed

Constant square in redtt #239

mortberg opened this issue Aug 16, 2018 · 12 comments · Fixed by #245
Labels

Comments

@mortberg
Copy link
Collaborator

Here's a small puzzle that we will need to solve by next week: given p : Path A a a construct a square with p everywhere on the boundary.

In cubicaltt this uses lots of connections/reversals:

https://github.com/mortberg/cubicaltt/blob/master/examples/prelude.ctt#L165

We would definitely want to avoid just copying this as it will be pretty huge without native connections/reversals. Can someone come up with a direct definition like the one used for connections?

I don't think it's important what the diagonal is, but if you can get it to be p as well then you get a bonus point!

@ecavallo
Copy link
Collaborator

The diagonal definitely can't be p, since it will be homotopic to p · p.

@mortberg
Copy link
Collaborator Author

mortberg commented Aug 16, 2018

Hahaha, good point Evan! If you get it to be p then you get infinitely many bonus point.

@ecavallo
Copy link
Collaborator

ecavallo commented Aug 16, 2018

Here's a (slightly more general) solution that is the size of two connections:

let connection/both
 (A : type)
 (p : dim → A) (q : [k] A [k=0 ⇒ p 1])
 : [i j] A [
   | j=0 ⇒ p i
   | i=0 ⇒ p j
   | j=1 ⇒ q i
   | i=1 ⇒ q j
   ]
 =
 λ i j →
   let face : dim → dim → A =
     λ m k →
       comp 0 m (p 1) [
       | k=0 ⇒ λ _ → p 1
       | k=1 ⇒ q
       ]
   in 
   comp 0 1 (connection/or A p i j) [
   | i=0 ⇒ λ _ → p j
   | i=1 ⇒ face j
   | j=0 ⇒ λ _ → p i
   | j=1 ⇒ face i
   ]

@mortberg
Copy link
Collaborator Author

Very nice and fast answer! Thanks Evan.

One thing that confuses me is the use of "comp"... aren't all of the compositions homogeneous?

@ecavallo
Copy link
Collaborator

I believe that the surface syntax comp elaborates to a com if a motive is given and an hcom otherwise.

@mortberg
Copy link
Collaborator Author

Cool!

Just a minor remark: I'm getting very owned by land 1 as they look identical in my browser's font... This makes the example quite hard to understand.

@ecavallo
Copy link
Collaborator

changed to an m :P

@mortberg
Copy link
Collaborator Author

Thanks! Now I see how your cube looks.

Note that the number of calls to comp in this term is 9. I wonder if this will lead to performance issues (imagine if A is a line in U...).

@ecavallo
Copy link
Collaborator

Here's a more direct solution which uses 7 comps:

let connection/both2
  (A : type)
  (p : dim → A) (q : [k] A [k=0 ⇒ p 1])
  : [i j] A [
    | j=0 ⇒ p i
    | i=0 ⇒ p j
    | j=1 ⇒ q i
    | i=1 ⇒ q j
    ]
  =
  λ i j →
    let pface : dim → dim → A =
      λ m k →
        comp 0 m (p 0) [
        | k=0 ⇒ λ _ → p 0
        | k=1 ⇒ p
        ]
    in
    let qface : dim → dim → A =
      λ m k → 
        comp 0 m (pface 1 k) [
        | k=0 ⇒ λ _ → p 0
        | k=1 ⇒ q
        ]
    in
    comp 0 1 (p 0) [
    | i=0 ⇒ pface j
    | i=1 ⇒ qface j
    | j=0 ⇒ pface i
    | j=1 ⇒ qface i
    ]

@ecavallo
Copy link
Collaborator

Here's one that uses 5:

let connection/both3
  (A : type)
  (p : dim → A) (q : [k] A [k=0 ⇒ p 1])
  : [i j] A [
    | j=0 ⇒ p i
    | i=0 ⇒ p j
    | j=1 ⇒ q i
    | i=1 ⇒ q j
    ]
  =
  λ i j →
    let pface : dim → dim → A =
      λ m k →
        comp 1 m (p k) [
        | k=0 ⇒ λ _ → p 0
        | k=1 ⇒ p
        ]
    in
    let qface : dim → dim → A =
      λ m k → 
        comp 0 m (p k) [
        | k=0 ⇒ λ _ → p 0
        | k=1 ⇒ q
        ]
    in
    comp 0 1 (p 0) [
    | i=0 ⇒ pface j
    | i=1 ⇒ qface j
    | j=0 ⇒ pface i
    | j=1 ⇒ qface i
    ]

@favonia
Copy link
Collaborator

favonia commented Aug 17, 2018

I missed the party. The same trick used by the pseudo-connections still applies, and all the current pseudo-connections should be replaced by Evan's last solution immediately.

@ecavallo ecavallo mentioned this issue Aug 17, 2018
@favonia
Copy link
Collaborator

favonia commented Aug 19, 2018

Actually, what I said was dumb. The current pseudo-connections are simpler and more powerful (with the correct diagonal) than the instances of Evan's final construction.

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

Successfully merging a pull request may close this issue.

4 participants