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

should flat be off by default? #4927

Closed
HuStmpHrrr opened this issue Sep 15, 2020 · 11 comments · Fixed by #6268
Closed

should flat be off by default? #4927

HuStmpHrrr opened this issue Sep 15, 2020 · 11 comments · Fixed by #6268
Assignees
Labels
documented-in-changelog Issues already documented in the CHANGELOG flat The @flat/@♭ modality type: discussion Discussions about Agda's design and implementation type: enhancement Issues and pull requests about possible improvements
Milestone

Comments

@HuStmpHrrr
Copy link
Member

it is strange to me that flat is on by default. I always think of Agda's type system as something around MLTT but the flat modality itself seems kicking it off the range. I am wondering why flat is on by default? I would expect a special option to turn it on as it is an addon feature.

@nad nad added flat The @flat/@♭ modality type: discussion Discussions about Agda's design and implementation type: enhancement Issues and pull requests about possible improvements labels Sep 16, 2020
@nad nad added this to the 2.6.2 milestone Sep 16, 2020
@nad
Copy link
Contributor

nad commented Sep 16, 2020

We have discussed this before. I am not opposed to a flag.

@Saizan
Copy link
Contributor

Saizan commented Sep 18, 2020

You need special syntax for it, and it doesn't add to the power of the type system unless you postulate things.

@jespercockx
Copy link
Member

You need special syntax for it, and it doesn't add to the power of the type system unless you postulate things.

The same is true for Prop (at least if you already have irrelevance), yet somehow it's still hidden under a flag.

@Saizan
Copy link
Contributor

Saizan commented Sep 18, 2020

I thought Prop was under a flag because of backwards incompatibilities wrt inference?

@Saizan
Copy link
Contributor

Saizan commented Sep 18, 2020

Irrelevance itself does not need a flag btw, and it's not something you have in plain MLTT.

@nad
Copy link
Contributor

nad commented Sep 18, 2020

I would not mind having a flag for irrelevance as well.

In order to make it easier to fix broken code I suggest that we do not add such flags until #3118 has been implemented.

@HuStmpHrrr
Copy link
Member Author

I would say we should have flags for every addon features.

@jespercockx
Copy link
Member

In order to make it easier to fix broken code I suggest that we do not add such flags until #3118 has been implemented.

It is now implemented, so go nuts with adding more flags I guess ;)

@nad
Copy link
Contributor

nad commented Oct 31, 2022

I noticed that the type Cohesion has three constructors:

-- | Cohesion modalities
-- see "Brouwer's fixed-point theorem in real-cohesive homotopy type theory" (arXiv:1509.07584)
-- types are now given an additional topological layer which the modalities interact with.
data Cohesion
= Flat -- ^ same points, discrete topology, idempotent comonad, box-like.
| Continuous -- ^ identity modality.
-- | Sharp -- ^ same points, codiscrete topology, idempotent monad, diamond-like.
| Squash -- ^ single point space, artificially added for Flat left-composition.

Should the flag for turning off this modality be called --flat, --cohesion, or something else? If it is called --cohesion, then it could perhaps be used also for the sharp modality, which is commented out above, if support for such a modality is added in the future (#5459).

@plt-amy suggested that one could refuse to parse @flat/@♭ unless the flag is on. Given that there are three constructors, does that suffice? There is only syntax for Flat:

cohesionAttributeTable :: [(String, Cohesion)]
cohesionAttributeTable =
[ ("" , Flat)
, ("flat" , Flat)
]

The default seems to be Continuous:

-- | Identity under composition
unitCohesion :: Cohesion
unitCohesion = Continuous

-- | Default Cohesion is the identity element under composition
defaultCohesion :: Cohesion
defaultCohesion = unitCohesion

Can one guarantee that Squash will never interfere with anything just by not parsing Flat? Note that Squash is part of zeroModality:

-- | 'Cohesion' forms a monoid under addition, and even a semiring.
zeroCohesion :: Cohesion
zeroCohesion = Squash

-- | Identity under addition
zeroModality :: Modality
zeroModality = Modality zeroRelevance zeroQuantity zeroCohesion

@nad
Copy link
Contributor

nad commented Oct 31, 2022

I added --cohesion.

@nad nad self-assigned this Oct 31, 2022
@nad nad modified the milestones: later, 2.6.3 Oct 31, 2022
@nad nad linked a pull request Oct 31, 2022 that will close this issue
@nad nad added the documented-in-changelog Issues already documented in the CHANGELOG label Oct 31, 2022
@plt-amy
Copy link
Member

plt-amy commented Oct 31, 2022

Well, aiui Squash is just what Continuous becomes when we go into a Flat context, right? Are there any other cases where we apply zeroModality to the context?

nad added a commit that referenced this issue Nov 1, 2022
@nad nad closed this as completed in #6268 Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documented-in-changelog Issues already documented in the CHANGELOG flat The @flat/@♭ modality type: discussion Discussions about Agda's design and implementation type: enhancement Issues and pull requests about possible improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants