Skip to content

Commit 8c1748c

Browse files
authored
chore: prefer use to refine (#129)
A few proofs that become more readable when using `use` versus `refine`. We should in general encourage this style, especially in proofs using `grind`, `omega`, etc.
1 parent 39af1c0 commit 8c1748c

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Cslib/Foundations/Data/Nat/Segment.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ theorem Nat.segment'_eq_segment (hm : StrictMono f) :
211211
· intro n ; simp only [mem_range, Finset.coe_filter, Finset.mem_range, mem_setOf_eq, mem_image]
212212
rintro ⟨h_n, i, rfl⟩
213213
have := StrictMono.monotone hm <| zero_le i
214-
refine ⟨f i - f 0, ⟨by omega, i, rfl⟩, by omega⟩
214+
use f i - f 0
215+
grind
215216

216217
/-- For a strictly monotonic function `f : ℕ → ℕ`, `segment f k = 0` for all `k ≤ f 0`. -/
217218
theorem Nat.segment_zero' (hm : StrictMono f) {k : ℕ} (h : k ≤ f 0) :

Cslib/Languages/CombinatoryLogic/Confluence.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,7 @@ theorem parallelReduction_diamond (a a₁ a₂ : SKI) (h₁ : a ⇒ₚ a₁) (h
182182
case red_S a c =>
183183
let ⟨a'', c', h⟩ := Sab_irreducible a c a' ha'
184184
rw [h.2.2]
185-
use a'' ⬝ b' ⬝ (c' ⬝ b')
186-
refine ⟨ParallelReduction.red_S a'' c' b', ?_⟩
185+
use a'' ⬝ b' ⬝ (c' ⬝ b'), ParallelReduction.red_S a'' c' b'
187186
apply ParallelReduction.par
188187
· apply ParallelReduction.par
189188
· exact h.1

Cslib/Languages/CombinatoryLogic/Defs.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ def CommonReduct : SKI → SKI → Prop := Relation.Join RedSKI.MRed
126126
lemma commonReduct_of_single {a b : SKI} (h : a ↠ b) : CommonReduct a b := ⟨b, h, by rfl⟩
127127

128128
theorem symmetric_commonReduct : Symmetric CommonReduct := Relation.symmetric_join
129-
theorem reflexive_commonReduct : Reflexive CommonReduct := fun x => by
130-
refine ⟨x,?_,?_⟩ <;> rfl
129+
130+
theorem reflexive_commonReduct : Reflexive CommonReduct := by
131+
intro x
132+
use x
131133

132134
theorem commonReduct_head {x x' : SKI} (y : SKI) : CommonReduct x x' → CommonReduct (x ⬝ y) (x' ⬝ y)
133135
| ⟨z, hz, hz'⟩ => ⟨z ⬝ y, MRed.head y hz, MRed.head y hz'⟩

0 commit comments

Comments
 (0)