Skip to content

Commit eaa25d0

Browse files
committed
Clean up
1 parent 98eaa9f commit eaa25d0

8 files changed

Lines changed: 59 additions & 60 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ check: generate
1414
generate:
1515
slope generate Rudin.Alpha
1616
slope generate Rudin.Partition
17+
slope generate Rudin.Partition.Prelude
1718
slope generate Rudin.Prelude
1819
slope generate Rudin.Lemmas
1920

Rudin/Partition.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import Rudin.Partition.Interval
1212
import Rudin.Partition.Monotone
1313
import Rudin.Partition.OrderBot
1414
import Rudin.Partition.Prelude
15-
import Rudin.Partition.Prelude.Nodup
16-
import Rudin.Partition.Prelude.SortedList
15+
import Rudin.Partition.Prelude.OrderedInsert
16+
import Rudin.Partition.Prelude.SortedLE
1717
import Rudin.Partition.Single
1818
import Rudin.Partition.SpecialPartitions
1919
import Rudin.Partition.Union

Rudin/Partition/Insert.lean

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ noncomputable def ι (h : IsInsertable x P) : Partition I
3838
:= by --
3939
let l' := P.l.orderedInsert (· ≤ ·) x
4040
have sorted' : l'.SortedLT := by
41-
sorry
42-
-- refine P.sorted'.orderedInsert_sorted_lt ?_
43-
-- rw [<-P.mem_iff_mem_list]
44-
-- exact h.notMem'
41+
refine P.sorted'.orderedInsert_sorted_lt ?_
42+
rw [<-P.mem_iff_mem_list]
43+
exact h.notMem'
4544
have h₀ : l' ≠ [] := by
4645
refine List.ne_nil_of_length_pos ?_
4746
rw [List.orderedInsert_length]
@@ -53,7 +52,7 @@ noncomputable def ι (h : IsInsertable x P) : Partition I
5352
have ha' : a ∈ l' := by
5453
rw [List.mem_orderedInsert]
5554
exact Or.inr P.mem_aᵢ
56-
exact List.sorted_head_min h₀ sorted'.sortedLE a ha'
55+
exact sorted'.sortedLE.sorted_head_min h₀ a ha'
5756
· -- a ≤ head. This follows from the minimality of a ∈ P.
5857
have h : l'.head h₀ ∈ l' := List.head_mem h₀
5958
rw [List.mem_orderedInsert] at h
@@ -76,7 +75,7 @@ noncomputable def ι (h : IsInsertable x P) : Partition I
7675
have hb' : b ∈ l' := by
7776
rw [List.mem_orderedInsert]
7877
exact Or.inr P.mem_bᵢ
79-
exact List.sorted_last_max h₀ sorted'.sortedLE b hb' -- ∎
78+
exact sorted'.sortedLE.sorted_last_max h₀ b hb' -- ∎
8079

8180
noncomputable def ι' (x : ℝ) (P : Partition I) : Partition I
8281
:= by --

Rudin/Partition/Prelude.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
import Rudin.Partition.Prelude.Nodup
2-
import Rudin.Partition.Prelude.SortedList
1+
import Rudin.Partition.Prelude.OrderedInsert
2+
import Rudin.Partition.Prelude.SortedLE
3+
set_option linter.style.longLine false
4+
35
-- WARNING: THIS FILE IS AUTO-GENERATED.

Rudin/Partition/Prelude/Nodup.lean renamed to Rudin/Partition/Prelude/OrderedInsert.lean

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,20 @@ theorem Nodup.orderedInsert (hl : l.Nodup) (hx : x ∉ l) : (l.orderedInsert (·
3838
let r : ℝ → ℝ → Prop := (· ≤ ·)
3939
induction l with
4040
| nil =>
41-
rw [List.orderedInsert, nodup_cons];
41+
rw [List.orderedInsert, nodup_cons]
4242
exact ⟨not_mem_nil, hl⟩
4343
| cons y ys ih =>
44-
have hys : ys.Nodup := hl.of_cons
45-
have hxys : x ∉ ys := not_mem_of_not_mem_cons hx
46-
specialize ih hl.of_cons (not_mem_of_not_mem_cons hx)
47-
change (ys.orderedInsert r x).Nodup at ih
4844
change ((y :: ys).orderedInsert r x).Nodup
4945
rw [List.orderedInsert]
50-
if hle : x ≤ y then
51-
have : r x y := hle
52-
simp only [↓reduceIte, this]
46+
if hle : r x y then -- x ≤ y
47+
simp only [↓reduceIte, hle]
5348
exact hl.cons hx
5449
else
55-
have : ¬r x y := hle
56-
simp only [↓reduceIte, this]
50+
simp only [↓reduceIte, hle]
5751
refine nodup_cons.mpr ?_
52+
specialize ih hl.of_cons (not_mem_of_not_mem_cons hx)
5853
refine ⟨?_, ih⟩
59-
rw [mem_orderedInsert]
60-
push_neg
54+
rw [mem_orderedInsert, not_or]
6155
refine ⟨?_, hl.notMem⟩
6256
exact (ne_of_not_mem_cons hx).symm -- ∎
6357

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import Mathlib.Data.List.NodupEquivFin
2+
3+
universe u
4+
5+
variable {α : Type u} [Preorder α] {l : List α}
6+
7+
namespace List
8+
9+
section Endpoints
10+
variable (h₀ : l ≠ []) (hl : l.SortedLE)
11+
12+
include h₀ hl in
13+
theorem SortedLE.sorted_head_min : ∀ x ∈ l, l.head h₀ ≤ x
14+
:= by --
15+
induction l with
16+
| nil => contradiction
17+
| cons a l ih =>
18+
intro x hx
19+
change a ≤ x
20+
replace hl := List.pairwise_cons.mp hl.pairwise
21+
replace hx := List.mem_cons.mp hx
22+
rcases hx with hxa | hxl
23+
· exact ge_of_eq hxa
24+
· exact hl.1 x hxl -- ∎
25+
26+
include h₀ hl in
27+
theorem SortedLE.sorted_last_max : ∀ x ∈ l, x ≤ l.getLast h₀
28+
:= by --
29+
intro x hx
30+
rw [mem_iff_get] at hx
31+
obtain ⟨i, hi⟩ := hx
32+
subst hi
33+
rw [getLast_eq_getElem h₀]
34+
exact hl <| Nat.le_sub_one_of_lt i.is_lt -- ∎
35+
36+
end Endpoints
37+
38+
end List

Rudin/Partition/Prelude/SortedList.lean

Lines changed: 0 additions & 35 deletions
This file was deleted.

Rudin/Partition/Union.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Rudin.Partition.Endpoints
2-
import Rudin.Partition.Prelude.SortedList
2+
import Rudin.Partition.Prelude.SortedLE
33

44
namespace Rudin
55

@@ -26,7 +26,7 @@ noncomputable instance : Union (Partition I)
2626
head' := by
2727
rw [<-List.head_eq_iff_head?_eq_some hl₀]
2828
refine le_antisymm ?_ ?_
29-
· exact List.sorted_head_min hl₀ hl_sort a hl_a
29+
· exact hl_sort.sorted_head_min hl₀ a hl_a
3030
· have h_min : s.min' hs₀ = a := by
3131
refine (Finset.min'_eq_iff s hs₀ a).mpr ⟨hs_a, fun x hx ↦ ?_⟩
3232
rcases Finset.mem_union.mp hx with hx₁ | hx₂
@@ -45,7 +45,7 @@ noncomputable instance : Union (Partition I)
4545
· exact P₂.max_b x hx₂
4646
rw [<-h_max]
4747
exact Finset.le_max' s _ (hl_mem.mp (List.getLast_mem hl₀))
48-
· exact List.sorted_last_max hl₀ hl_sort b hl_b
48+
· exact hl_sort.sorted_last_max hl₀ b hl_b
4949
sorted' := Finset.sortedLT_sort s
5050
} -- ∎
5151

0 commit comments

Comments
 (0)