Skip to content

Commit 9ce72d9

Browse files
committed
Restructure proofs for readability
1 parent a681ca1 commit 9ce72d9

1 file changed

Lines changed: 35 additions & 27 deletions

File tree

IrisMath/IrisMath/StepIndex.lean

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,22 @@ instance ordinalSIdx : SIdx Ordinal where
2222
lt_trans := lt_trans
2323
lt_wf := Ordinal.lt_wf
2424
lt_trichotomyT n m :=
25-
if h : n < m then .inl h
26-
else if h' : m < n then .inr <| .inr h'
27-
else .inr <| .inl <| le_antisymm (not_lt.mp h') (not_lt.mp h)
25+
if h : n < m then by left; exact h
26+
else if h' : m < n then by right; right; exact h'
27+
else by right; left; exact le_antisymm (not_lt.mp h') (not_lt.mp h)
2828
le_lteq := le_iff_lt_or_eq
2929
not_lt_zero _ := by simp
3030
lt_succ_self := Order.lt_succ
3131
succ_le_of_lt := Order.succ_le_of_lt
3232
weak_case n :=
3333
letI : Decidable (∃ m, n = Order.succ m) := Classical.propDecidable _
34-
if h : ∃ m, n = Order.succ m then
35-
.inl ⟨h.choose, h.choose_spec⟩
36-
else
37-
.inr fun m hm => lt_of_le_of_ne (Order.succ_le_of_lt hm) fun he => h ⟨m, he.symm⟩
34+
if h : ∃ m, n = Order.succ m then by left; exact ⟨h.choose, h.choose_spec⟩
35+
else by
36+
right; intro m hm
37+
apply lt_of_le_of_ne
38+
· exact Order.succ_le_of_lt hm
39+
· intro he
40+
exact h ⟨m, he.symm⟩
3841

3942
@[reducible]
4043
def ordinalSubtypeSIdx (κ : Ordinal) (hκ : Order.IsSuccLimit κ) :
@@ -46,9 +49,9 @@ def ordinalSubtypeSIdx (κ : Ordinal) (hκ : Order.IsSuccLimit κ) :
4649
lt_trans := lt_trans
4750
lt_wf := InvImage.wf Subtype.val Ordinal.lt_wf
4851
lt_trichotomyT n m :=
49-
if h : n < m then .inl h
50-
else if h' : m < n then .inr <| .inr h'
51-
else .inr <| .inl <| le_antisymm (not_lt.mp h') (not_lt.mp h)
52+
if h : n < m then by left; exact h
53+
else if h' : m < n then by right; right; exact h'
54+
else by right; left; exact le_antisymm (not_lt.mp h') (not_lt.mp h)
5255
le_lteq := le_iff_lt_or_eq
5356
not_lt_zero n :=
5457
show ¬n.val < 0
@@ -58,15 +61,17 @@ def ordinalSubtypeSIdx (κ : Ordinal) (hκ : Order.IsSuccLimit κ) :
5861
change Order.succ n.val ≤ m.val
5962
simpa
6063
weak_case n :=
61-
letI : Decidable (∃ m, n = (fun o : { o // o < κ } =>
62-
⟨Order.succ o.val, hκ.succ_lt o.property⟩) m) :=
63-
Classical.propDecidable _
64-
if h : ∃ m, n = (fun o => ⟨Order.succ o.val, hκ.succ_lt o.property⟩) m then
65-
.inl ⟨h.choose, h.choose_spec⟩
66-
else
67-
.inr fun m hm =>
68-
lt_of_le_of_ne (Order.succ_le_of_lt hm : Order.succ m.val ≤ n.val)
69-
fun he => h ⟨m, he.symm⟩
64+
let succFn : {o : Ordinal // o < κ} → {o : Ordinal // o < κ} :=
65+
fun o => ⟨Order.succ o.val, hκ.succ_lt o.property⟩
66+
letI : Decidable (∃ m, n = succFn m) := Classical.propDecidable _
67+
if h : ∃ m, n = succFn m then by
68+
left; exact ⟨h.choose, h.choose_spec⟩
69+
else by
70+
right; intro m hm
71+
apply lt_of_le_of_ne
72+
· exact (Order.succ_le_of_lt hm : Order.succ m.val ≤ n.val)
73+
· intro he
74+
exact h ⟨m, he.symm⟩
7075

7176
@[reducible]
7277
def ordinalToTypeSIdx (κ : Ordinal) (hκ : Order.IsSuccLimit κ) : SIdx κ.ToType :=
@@ -83,20 +88,23 @@ def ordinalToTypeSIdx (κ : Ordinal) (hκ : Order.IsSuccLimit κ) : SIdx κ.ToTy
8388
lt_trans := lt_trans
8489
lt_wf := wellFounded_lt
8590
lt_trichotomyT n m :=
86-
if h : n < m then .inl h
87-
else if h' : m < n then .inr <| .inr h'
88-
else .inr <| .inl <| le_antisymm (not_lt.mp h') (not_lt.mp h)
91+
if h : n < m then by left; exact h
92+
else if h' : m < n then by right; right; exact h'
93+
else by right; left; exact le_antisymm (not_lt.mp h') (not_lt.mp h)
8994
le_lteq := le_iff_lt_or_eq
9095
not_lt_zero _ := not_lt_bot
9196
lt_succ_self := Order.lt_succ
9297
succ_le_of_lt := Order.succ_le_of_lt
9398
weak_case n :=
9499
letI : Decidable (∃ m, n = Order.succ m) := Classical.propDecidable _
95-
if h : ∃ m, n = Order.succ m then
96-
.inl ⟨h.choose, h.choose_spec⟩
97-
else
98-
.inr fun m hm =>
99-
lt_of_le_of_ne (Order.succ_le_of_lt hm) fun he => h ⟨m, he.symm⟩
100+
if h : ∃ m, n = Order.succ m then by
101+
left; exact ⟨h.choose, h.choose_spec⟩
102+
else by
103+
right; intro m hm
104+
apply lt_of_le_of_ne
105+
· exact Order.succ_le_of_lt hm
106+
· intro he
107+
exact h ⟨m, he.symm⟩
100108
}
101109

102110
theorem limit_iff_isSuccLimit {o : Ordinal} : SIdx.Limit o ↔ Order.IsSuccLimit o := by

0 commit comments

Comments
 (0)