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

Adds theorem and proof construct [new base] #1322

Closed
wants to merge 22 commits into from

Conversation

nskh
Copy link
Collaborator

@nskh nskh commented Jul 8, 2024

Replaces #1263, #1308.

In-progress PR to add a theorem keyword in the style of let-equals-in to Hazel.

Based on editor-output this time.

TODO:

  • change sorting to theorem pat = exp in exp, which matches let expressions exactly
  • have theorem behave exactly like a let expression everywhere else in the codebase
  • at the type level, rename existing forall to type
  • add new forall pat -> ty construct to types
  • add {e1 = e2} form to types
  • syntax highlighting for the pattern in the forall type
  • change "=" to "proof" in syntax
  • explainthis documentation for new constructs
  • cursor inspector behavior for new constructs
  • Theorem explainthis should be different from let
  • elaboration (same as let expression)
  • Static analysis within new constructs?
  • Fix stack overflow

@nskh nskh requested a review from Negabinary July 8, 2024 22:29
@nskh nskh marked this pull request as draft July 8, 2024 23:17
@thomasporter522
Copy link

Should foralls be annotated? forall pat : ty -> ty ?

@cyrus-
Copy link
Member

cyrus- commented Jul 23, 2024

No, pat includes compositional support for (multiple) type annotations already.

@thomasporter522
Copy link

I am unable to make sense of the error messages for the automatic build action, sorry

@cyrus-
Copy link
Member

cyrus- commented Jul 24, 2024

@thomasporter522 those messages are from the automatic code formatter needing to fix the formatting. you should make sure the autoformatting is run before commiting. may also be a make deps issue, make sure you have the same formatter version as the one the build script is using.

@thomasporter522
Copy link

Local issue: If you type:

let y : forall x -> = in

Then, after the arrow, type

{x}

Then press the left arrow key, the program will crash due to something related to the head of an empty list or something about "nonconvex segment."

@cyrus-
Copy link
Member

cyrus- commented Jul 26, 2024

No idea what is going on there -- maybe @disconcision or @dm0n3y have an idea?

@disconcision
Copy link
Member

disconcision commented Jul 26, 2024

@thomasporter522 to clarify, what you've written is bad syntax yes as the {}s require a =?

three-delimiter forms have never been 100% functional in hazel3. all of the existing ones break with a nonconvex segment error if you try to delete the middle delimiter while the others are not in the backpack (e.g. try to delete the = for a let). this is likely the same or a closely related issue; it might be somewhat different since technically we've never tried to implement a convex tile with three delimiters.

this is related to core segment logic which i don't really understand. unless @dm0n3y wants to attempt a fix, you might be able to work around this by making [{, }] and [=] separate forms which are parsed together in MakeTerm, similar to how tuples and list literals are. you could also make their decorations conjoined using similar logic.

@thomasporter522
Copy link

@disconcision The answer to your clarification is "yes". Thanks for the explanation and possible workaround. Do you think the upcoming syntax model fix the issue?

@disconcision
Copy link
Member

yes, the upcoming syntax model fully accounts for this case, so whether the workaround is worth it depends on timelines

@thomasporter522 thomasporter522 self-assigned this Aug 7, 2024
@cyrus-
Copy link
Member

cyrus- commented Aug 20, 2024

closing in favor of #1376

@cyrus- cyrus- closed this Aug 20, 2024
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.

4 participants