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

feat: PProd and MProd syntax (part 2) #4730

Merged
merged 1 commit into from
Jul 15, 2024
Merged

feat: PProd and MProd syntax (part 2) #4730

merged 1 commit into from
Jul 15, 2024

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Jul 12, 2024

the internal constructions for structural and well-founded recursion
use plenty of PProd and MProd, and reading these, deeply
nested and in prefix notation, is unnecessarily troublesome.

Therefore this introduces notations

a ×ₚ b   -- PProd a b
a ×ₘ b   -- MProd a b
()ₚ      -- PUnit.unit
(x,y,z)ₚ -- PProd.mk x (PProd.mk y z)
(x,y,z)ₘ -- MProd.mk x (MProd.mk y z)

(This is the post-stage0-part 2.)

@nomeata nomeata requested a review from Kha as a code owner July 12, 2024 08:43
@nomeata nomeata added the awaiting-review Waiting for someone to review the PR label Jul 12, 2024
@nomeata nomeata requested a review from kmill July 12, 2024 08:43
@github-actions github-actions bot added the changes-stage0 Contains stage0 changes, merge manually using rebase label Jul 12, 2024
@nomeata nomeata changed the title joachim/pprod syntax feat: PProd and MProd syntax Jul 12, 2024
@nomeata
Copy link
Collaborator Author

nomeata commented Jul 12, 2024

Not sure if it is acceptable to waste syntax space on something internal like this, hence marking as awaiting-review.

This seems to need a stage0 update after defining the parser, unless I am mistaken.

@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jul 12, 2024
@nomeata nomeata force-pushed the joachim/pprod-syntax branch from d5f6f6e to 06e19e5 Compare July 12, 2024 09:21
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Jul 12, 2024

Mathlib CI status (docs):

  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2024-07-12 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. (2024-07-12 09:34:26)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase ab0241dac8204402a42f6820071561ee7bbe4801 --onto 5f70c1ca64a2c05a5866c47b9eb80a92034433ec. (2024-07-15 15:43:00)

@nomeata nomeata force-pushed the joachim/pprod-syntax branch from 06e19e5 to 67bdcfe Compare July 12, 2024 10:00
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 12, 2024 10:16 Inactive
@nomeata nomeata added will-merge-soon …unless someone speaks up and removed awaiting-review Waiting for someone to review the PR labels Jul 15, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jul 15, 2024
the internal constructions for structural and well-founded recursion
use plenty of `PProd` and `MProd`, and reading these, deeply
nested and in prefix notation, is unnecessarily troublesome.

Therefore this introduces notations
```
a ×ₚ b   -- PProd a b
a ×ₘ b   -- MProd a b
()ₚ      -- PUnit.unit
(x,y,z)ₚ -- PProd.mk x (PProd.mk y z)
(x,y,z)ₘ -- MProd.mk x (MProd.mk y z)
```

(This is part 1, the rest will follow in #4730 after a stage0 update.)
actually enables the syntax, adds a test file and updates the test
output.
@nomeata nomeata force-pushed the joachim/pprod-syntax branch from 67bdcfe to c9fbd76 Compare July 15, 2024 15:24
@nomeata nomeata changed the title feat: PProd and MProd syntax feat: PProd and MProd syntax (part 2) Jul 15, 2024
@github-actions github-actions bot removed the changes-stage0 Contains stage0 changes, merge manually using rebase label Jul 15, 2024
@nomeata nomeata enabled auto-merge July 15, 2024 15:25
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc July 15, 2024 15:35 Inactive
@nomeata nomeata added this pull request to the merge queue Jul 15, 2024
Merged via the queue into master with commit 180c6aa Jul 15, 2024
15 checks passed
@kmill
Copy link
Collaborator

kmill commented Jul 15, 2024

Not sure if it is acceptable to waste syntax space on something internal like this, hence marking as awaiting-review.

I was just about to take a look at this PR at the start of my day and was surprised to see it's already been merged — that gave me just one working day, and Friday I wasn't doing any Lean.

I'm not sure about global "p" and "m" tuple notation. Are users supposed to figure out they mean "polymorphic" and "monomorphic"? Should these notations be scoped since these are fairly specialized? Are there alternative notations? Did we check other projects that we're not stepping on their pre-existing notations?

I would have strongly suggested that the notation PProd use ×' since PSigma already uses it, and then it would parallel the notation for Prod/Sigma, at least for types. This is missing any special notation for PProd terms however.

@nomeata
Copy link
Collaborator Author

nomeata commented Jul 15, 2024

You are absolutely right, I was a bit too trigger happy with this PR.

I disregarded ×' because it is already used for PSigma, but you are right that this is actually more reason to use it here.

And for terms: Special syntax isn’t actually needed given that we can use angle brackets.

I’ll change this tomorrow or so.

Sorry for the confusion, I should have waited for your feedback.

nomeata added a commit that referenced this pull request Jul 16, 2024
reworks #4730 based on feedback from @kmill:

 * Uses `×'` for PProd
 * No syntax for MProd for now
 * Plain `pp_using_anonymous_constructor` for the values
github-merge-queue bot pushed a commit that referenced this pull request Jul 16, 2024
reworks #4730 based on feedback from @kmill:

 * Uses `×'` for PProd
 * No syntax for MProd for now
 * Angle brackets (without nesting) for the values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN will-merge-soon …unless someone speaks up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants