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

Began implementing intrinsically typed regions #476

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

imbrem
Copy link

@imbrem imbrem commented Jul 22, 2024

No description provided.

Copy link
Collaborator

@bollu bollu left a comment

Choose a reason for hiding this comment

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

LGTM after changes I've made, but also ping @tobiasgrosser. @alexkeizer on Zulip.

SSA/Projects/IntrinsicRegions/Framework.lean Show resolved Hide resolved
SSA/Projects/IntrinsicRegions/Framework.lean Outdated Show resolved Hide resolved
SSA/Core/ErasedContext.lean Show resolved Hide resolved
Copy link

Alive Statistics: 59 / 93 (34 failed)

Comment on lines 27 to 42
/--
Typeclass for a `baseType` which supports Gödel codes for coproducts
-/
class TyHasCoprodDenote (β : Type) [TyDenote β] [C : TyHasCoprod β] where
inl : toType a → toType (C.coprod a b)
inr : toType a → toType (C.coprod a b)
elim : (toType a → γ) → (toType b → γ) → toType (C.coprod a b) → γ

/-
TODO: implement a thing `left? : toType (C.coprod α β) → Option (toType α)` using `elim`. This will
allow us to cleanup case_inl by writing `(ha : (l : toType α) ∈ a.evaluate VΓ |>.left?)`
-/

/-
TODO: add lawful instance of TyHasCoprodDenote for proving properties about the universal property.
-/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be easier to have LawfulTyHasCoprod simply state that for all a, b : Ty, it is the case that toType (C.coprod a b) is equivalent to Sum (toType a) (toType b), then you would not need TyHasCoprodDenote at all anymore

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think that suffices, because my iso can be non-natural. I can do the terrible trick I showed you last time, where I match on a : Ty and build something super non-canonical.

Copy link
Collaborator

@alexkeizer alexkeizer Jul 22, 2024

Choose a reason for hiding this comment

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

my iso can be non-natural

I'm not sure what natural means in this context?

You're right that this equivalence is stronger than TyHasCoprodDenote as currently stated, but surely a Lawful version would impy the equivalence?
Normally, you'd separate out the laws into a separate typeclass to facilitate programming where you might not necessarily care about things being 100% lawful, but that hardly seems applicable in our setting; if you're just programming you'd probably use untyped datastructures, rather than our highly dependent ones.

Copy link

Alive Statistics: 59 / 93 (34 failed)

Copy link

Alive Statistics: 59 / 93 (34 failed)

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