-
Notifications
You must be signed in to change notification settings - Fork 1.3k
chore: make IsSuccLimit a structure
#38234
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
Open
vihdzp
wants to merge
4
commits into
leanprover-community:master
Choose a base branch
from
vihdzp:succtop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+35
−28
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -76,50 +76,64 @@ It's so named because in a successor order, a successor limit can't be the succe | |||||
| smaller. | ||||||
|
|
||||||
| Use `IsSuccPrelimit` if you want to include the case of a minimal element. -/ | ||||||
| @[to_dual | ||||||
| /-- A predecessor limit is a value that isn't maximal and doesn't cover any other. | ||||||
| @[mk_iff] | ||||||
| structure IsSuccLimit (a : α) : Prop where | ||||||
| /-- Successor limits aren't minimal. -/ | ||||||
| not_isMin : ¬ IsMin a | ||||||
| /-- Successor limits don't cover any other elements. -/ | ||||||
| isSuccPrelimit : IsSuccPrelimit a | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| /-- A predecessor limit is a value that isn't maximal and isn't covered by any other. | ||||||
|
|
||||||
| It's so named because in a predecessor order, a predecessor limit can't be the predecessor of | ||||||
| anything larger. | ||||||
|
|
||||||
| Use `IsPredPrelimit` if you want to include the case of a maximal element. -/] | ||||||
| def IsSuccLimit (a : α) : Prop := | ||||||
| ¬ IsMin a ∧ IsSuccPrelimit a | ||||||
| Use `IsPredPrelimit` if you want to include the case of a maximal element. -/ | ||||||
| @[mk_iff, to_dual existing] | ||||||
| structure IsPredLimit (a : α) : Prop where | ||||||
| /-- Predecessor limits aren't maximal. -/ | ||||||
| not_isMax : ¬ IsMax a | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| /-- Predecessor limits aren't covered by any other elements. -/ | ||||||
| isPredPrelimit : IsPredPrelimit a | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| attribute [to_dual existing] | ||||||
| IsSuccLimit.mk IsSuccLimit.not_isMin IsSuccLimit.isSuccPrelimit isSuccLimit_iff | ||||||
| attribute [simp] IsSuccLimit.isSuccPrelimit IsPredLimit.isPredPrelimit | ||||||
|
|
||||||
| @[to_dual (attr := simp)] | ||||||
| theorem isSuccLimit_toDual_iff : IsSuccLimit (toDual a) ↔ IsPredLimit a := by | ||||||
| simp [IsSuccLimit, IsPredLimit] | ||||||
| simp [isSuccLimit_iff, isPredLimit_iff] | ||||||
|
|
||||||
| @[to_dual] alias ⟨_, IsPredLimit.dual⟩ := isSuccLimit_toDual_iff | ||||||
|
|
||||||
| @[to_dual] | ||||||
| protected theorem IsSuccLimit.not_isMin (h : IsSuccLimit a) : ¬ IsMin a := h.1 | ||||||
|
|
||||||
| @[to_dual (attr := simp)] | ||||||
| protected theorem IsSuccLimit.isSuccPrelimit (h : IsSuccLimit a) : IsSuccPrelimit a := h.2 | ||||||
| theorem not_isSuccLimit_iff : ¬ IsSuccLimit a ↔ IsMin a ∨ ¬ IsSuccPrelimit a := by | ||||||
| rw [isSuccLimit_iff, not_and_or, not_not] | ||||||
|
|
||||||
| @[deprecated IsPredLimit.isPredPrelimit (since := "2026-02-22")] | ||||||
| theorem not_isPredLimit_of_not_isPredPrelimit : ¬ IsPredPrelimit a → ¬ IsPredLimit a := | ||||||
| mt IsPredLimit.isPredPrelimit | ||||||
|
|
||||||
| @[to_dual] | ||||||
| set_option linter.existingAttributeWarning false in | ||||||
| @[to_dual, deprecated IsSuccLimit.mk (since := "2026-04-19")] | ||||||
| theorem IsSuccPrelimit.isSuccLimit_of_not_isMin (h : IsSuccPrelimit a) (ha : ¬ IsMin a) : | ||||||
| IsSuccLimit a := | ||||||
| ⟨ha, h⟩ | ||||||
|
|
||||||
| @[to_dual] | ||||||
| theorem IsSuccPrelimit.isSuccLimit [NoMinOrder α] (h : IsSuccPrelimit a) : IsSuccLimit a := | ||||||
| h.isSuccLimit_of_not_isMin (not_isMin a) | ||||||
| attribute [deprecated IsPredLimit.mk (since := "2026-04-19")] | ||||||
| IsPredPrelimit.isPredLimit_of_not_isMax | ||||||
|
|
||||||
| @[to_dual] | ||||||
| theorem isSuccPrelimit_iff_isSuccLimit_of_not_isMin (h : ¬ IsMin a) : | ||||||
| IsSuccPrelimit a ↔ IsSuccLimit a := | ||||||
| ⟨fun ha ↦ ha.isSuccLimit_of_not_isMin h, IsSuccLimit.isSuccPrelimit⟩ | ||||||
| IsSuccPrelimit a ↔ IsSuccLimit a := by | ||||||
| simp [isSuccLimit_iff, h] | ||||||
|
|
||||||
| @[to_dual] | ||||||
| theorem isSuccPrelimit_iff_isSuccLimit [NoMinOrder α] : IsSuccPrelimit a ↔ IsSuccLimit a := | ||||||
| isSuccPrelimit_iff_isSuccLimit_of_not_isMin (not_isMin a) | ||||||
|
|
||||||
| @[to_dual] alias ⟨IsSuccPrelimit.isSuccLimit, _⟩ := isSuccPrelimit_iff_isSuccLimit | ||||||
|
|
||||||
| @[to_dual] | ||||||
| protected theorem _root_.IsMin.not_isSuccLimit (h : IsMin a) : ¬ IsSuccLimit a := | ||||||
| fun ha ↦ ha.not_isMin h | ||||||
|
|
@@ -151,10 +165,6 @@ theorem IsSuccLimit.ne_bot [OrderBot α] (h : IsSuccLimit a) : a ≠ ⊥ := by | |||||
| rintro rfl | ||||||
| exact not_isSuccLimit_bot h | ||||||
|
|
||||||
| @[to_dual] | ||||||
| theorem not_isSuccLimit_iff : ¬ IsSuccLimit a ↔ IsMin a ∨ ¬ IsSuccPrelimit a := by | ||||||
| rw [IsSuccLimit, not_and_or, not_not] | ||||||
|
|
||||||
| @[to_dual] | ||||||
| theorem IsSuccPrelimit.subtypeVal {s : Set α} (hs : IsLowerSet s) {a : s} | ||||||
| (ha : IsSuccPrelimit a) : IsSuccPrelimit a.1 := by | ||||||
|
|
@@ -261,10 +271,7 @@ variable [PartialOrder α] | |||||
|
|
||||||
| @[to_dual] | ||||||
| theorem isSuccLimit_iff_of_orderBot [OrderBot α] : IsSuccLimit a ↔ a ≠ ⊥ ∧ IsSuccPrelimit a := by | ||||||
| rw [IsSuccLimit, isMin_iff_eq_bot] | ||||||
|
|
||||||
| @[deprecated (since := "2026-03-31")] alias isSuccLimit_iff := isSuccLimit_iff_of_orderBot | ||||||
| @[deprecated (since := "2026-03-31")] alias isPredLimit_iff := isPredLimit_iff_of_orderTop | ||||||
| rw [isSuccLimit_iff, isMin_iff_eq_bot] | ||||||
|
|
||||||
| @[to_dual lt_top] | ||||||
| theorem IsSuccLimit.bot_lt [OrderBot α] (h : IsSuccLimit a) : ⊥ < a := | ||||||
|
|
@@ -298,7 +305,7 @@ theorem mem_range_succ_or_isSuccPrelimit (a) : a ∈ range (succ : α → α) | |||||
| @[to_dual] | ||||||
| theorem isMin_or_mem_range_succ_or_isSuccLimit (a) : | ||||||
| IsMin a ∨ a ∈ range (succ : α → α) ∨ IsSuccLimit a := by | ||||||
| rw [IsSuccLimit] | ||||||
| rw [isSuccLimit_iff] | ||||||
| have := mem_range_succ_or_isSuccPrelimit a | ||||||
| tauto | ||||||
|
|
||||||
|
|
@@ -527,7 +534,7 @@ and successor limits. -/ | |||||
| and predecessor limits. -/] | ||||||
| noncomputable def isSuccLimitRecOn : motive b := | ||||||
| isSuccPrelimitRecOn b succ fun a ha ↦ | ||||||
| if h : IsMin a then isMin a h else isSuccLimit a (ha.isSuccLimit_of_not_isMin h) | ||||||
| if h : IsMin a then isMin a h else isSuccLimit a ⟨h, ha⟩ | ||||||
|
|
||||||
| @[to_dual (attr := simp)] | ||||||
| theorem isSuccLimitRecOn_of_isSuccLimit (hb : IsSuccLimit b) : | ||||||
|
|
@@ -640,7 +647,7 @@ minimal element. -/ | |||||
| minimal element. -/] | ||||||
| noncomputable def limitRecOn : motive b := | ||||||
| prelimitRecOn b succ fun a ha IH ↦ | ||||||
| if h : IsMin a then isMin a h else isSuccLimit a (ha.isSuccLimit_of_not_isMin h) IH | ||||||
| if h : IsMin a then isMin a h else isSuccLimit a ⟨h, ha⟩ IH | ||||||
|
|
||||||
| @[to_dual (attr := simp)] | ||||||
| theorem limitRecOn_isMin (hb : IsMin b) : limitRecOn b isMin succ isSuccLimit = isMin b hb := by | ||||||
|
|
||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.