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: parity between structure instance notation and where notation #6165

Merged
merged 3 commits into from
Nov 30, 2024

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Nov 21, 2024

This PR modifies structure instance notation and where notation to use the same notation for fields. Structure instance notation now admits binders, type ascriptions, and equations, and where notation admits full structure lvals. Examples of these for structure instance notation:

structure PosFun where
  f : Nat → Nat
  pos : ∀ n, 0 < f n

def p : PosFun :=
  { f n := n + 1
    pos := by simp }

def p' : PosFun :=
  { f | 0 => 1
      | n + 1 => n + 1
    pos := by rintro (_|_) <;> simp }

Just like for the structure where notation, a field f x y z : ty := val expands to f := fun x y z => (val : ty). The type ascription is optional.

The PR also is setting things up for future expansion. Pending some discussion, in the future structure/where notation could have have embedded where clauses; rather than { a := { x := 1, y := z } } one could write { a where x := 1; y := z }.

@kmill kmill added the changelog-language Language features, tactics, and metaprograms label Nov 21, 2024
@kmill kmill requested a review from Kha as a code owner November 21, 2024 22:47
@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 Nov 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Nov 21, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 21, 2024
@leanprover-community-bot leanprover-community-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Nov 21, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Nov 21, 2024

Mathlib CI status (docs):

  • 💥 Mathlib branch lean-pr-testing-6165 build failed against this PR. (2024-11-21 23:21:57) View Log
  • 💥 Mathlib branch lean-pr-testing-6165 build failed against this PR. (2024-11-22 01:58:49) View Log
  • 💥 Mathlib branch lean-pr-testing-6165 build failed against this PR. (2024-11-30 03:06:34) View Log
  • ✅ Mathlib branch lean-pr-testing-6165 has successfully built against this PR. (2024-11-30 04:03:44) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 734ea3071d67c3002867ccd767b8c3d80cc4e28d --onto 86f303774a7fbf38406ae13bd4b66f2753643a45. (2024-11-30 13:29:04)

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Nov 22, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 22, 2024
@kmill kmill force-pushed the struct_inst_field_args branch from 44c24ea to c641323 Compare November 30, 2024 02:38
@kmill kmill changed the title feat: allow fields in structure instance notation to have arguments feat: parity between structure instance notation and where notation Nov 30, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Nov 30, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 30, 2024
@leanprover-community-bot leanprover-community-bot added builds-mathlib CI has verified that Mathlib builds against this PR and removed breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Nov 30, 2024
kmill added a commit to kmill/lean4 that referenced this pull request Nov 30, 2024
This PR is preparation for changes to structure instance notation in leanprover#6165. It adds a syntax category that will be used for field syntax.
github-merge-queue bot pushed a commit that referenced this pull request Nov 30, 2024
This PR is preparation for changes to structure instance notation in
#6165. It adds a syntax category that will be used for field syntax.
@kmill kmill force-pushed the struct_inst_field_args branch from c641323 to c87782d Compare November 30, 2024 13:04
@kmill kmill enabled auto-merge November 30, 2024 20:06
@kmill kmill added this pull request to the merge queue Nov 30, 2024
Merged via the queue into leanprover:master with commit a1c3a36 Nov 30, 2024
16 checks passed
kmill added a commit to kmill/lean4 that referenced this pull request Dec 1, 2024
This PR puts code in terms of syntax quotations now that there has been a stage0 update. Fixes a lingering bug in StructInst where some intermediate syntax was malformed, but this had no observable effects outside of some debug messages.
github-merge-queue bot pushed a commit that referenced this pull request Dec 1, 2024
This PR puts code in terms of syntax quotations now that there has been
a stage0 update. Fixes a lingering bug in StructInst where some
intermediate syntax was malformed, but this had no observable effects
outside of some debug messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features, tactics, and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants