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

[Merged by Bors] - refactor(data/pi/lex): Use lex, provide notation #14164

Closed
wants to merge 3 commits into from

Conversation

YaelDillies
Copy link
Collaborator

Delete pilex ι β in favor of lex (Π i, β i) which we provide Πₗ i, β i notation for.


Open in Gitpod

@YaelDillies YaelDillies added the awaiting-review The author would like community review of the PR label May 15, 2022
∃ i, (∀ j, r j i → x j = y j) ∧ s (x i) (y i)

/-- The cartesian product of an indexed family, equipped with the lexicographic order. -/
def pilex (α : Type*) (β : α → Type*) : Type* := Π a, β a
notation `Πₗ` binders `, ` r:(scoped p, lex (Π i, p i)) := r
Copy link
Member

Choose a reason for hiding this comment

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

Should this be

Suggested change
notation `Πₗ` binders `, ` r:(scoped p, lex (Π i, p i)) := r
notation `Πₗ ` binders `, ` r:(scoped p, lex (Π i, p i)) := r

or does lean add the space automaticaly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems like it does. This is the infoview on line 147 of data.sigma.order.

_x : Σₗ (i : ι), α i

and this is the notation declaration

notation `Σₗ` binders `, ` r:(scoped p, _root_.lex (sigma p)) := r

However my new notation gets torn in the infoview.

a b : lex (Π (i : ι), (λ (i : ι), β i) i)

Is there an equivalent of sigma p (as opposed to Σ i, p i) for Π i, p i?

Copy link
Member

Choose a reason for hiding this comment

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

Is there an equivalent of sigma p (as opposed to Σ i, p i) for Π i, p i?

No, because if there were it would need two copies of itself in its own type!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah yeah of course 😕

Copy link
Member

Choose a reason for hiding this comment

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

Maybe best to not actually use the notation in this file then, so that the instances and lemmas are fully delta-reduced.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should I even introduce the notation then? There's no point in having it if we can't use it. An alternative would be the rather less practical Πₗ β.

Copy link
Member

Choose a reason for hiding this comment

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

I think the notation could still be useful within a proof if you're constructing some big nested lex object; the delta reductions are probably mostly harmless, but keeping them out of the basic API lemmas is worth the trouble.

@bors
Copy link

bors bot commented May 16, 2022

✌️ YaelDillies can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

LGTM!

I'd assumed this change had already been made...

bors d+

@leanprover-community-bot-assistant leanprover-community-bot-assistant added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels May 16, 2022
@eric-wieser
Copy link
Member

eric-wieser commented May 16, 2022

You should probably add the lemmas that to_lex x i = x i and of_lex x i = x i in this file (or similar).

@YaelDillies
Copy link
Collaborator Author

bors merge

bors bot pushed a commit that referenced this pull request May 16, 2022
Delete `pilex ι β` in favor of `lex (Π i, β i)` which we provide `Πₗ i, β i` notation for.
@bors
Copy link

bors bot commented May 16, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(data/pi/lex): Use lex, provide notation [Merged by Bors] - refactor(data/pi/lex): Use lex, provide notation May 16, 2022
@bors bors bot closed this May 16, 2022
@bors bors bot deleted the pi_lex_notation branch May 16, 2022 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants