Skip to content

Commit

Permalink
chore: reduce usage of refine' (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoFX authored Sep 9, 2024
1 parent 2b13f6c commit 869f2ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Batteries/Data/Rat/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ theorem normalize_eq_iff (z₁ : d₁ ≠ 0) (z₂ : d₂ ≠ 0) :
normalize n₁ d₁ z₁ = normalize n₂ d₂ z₂ ↔ n₁ * d₂ = n₂ * d₁ := by
constructor <;> intro h
· simp only [normalize_eq, mk'.injEq] at h
have' hn₁ := Int.ofNat_dvd_left.2 <| Nat.gcd_dvd_left n₁.natAbs d₁
have' hn₂ := Int.ofNat_dvd_left.2 <| Nat.gcd_dvd_left n₂.natAbs d₂
have' hd₁ := Int.ofNat_dvd.2 <| Nat.gcd_dvd_right n₁.natAbs d₁
have' hd₂ := Int.ofNat_dvd.2 <| Nat.gcd_dvd_right n₂.natAbs d₂
have hn₁ := Int.ofNat_dvd_left.2 <| Nat.gcd_dvd_left n₁.natAbs d₁
have hn₂ := Int.ofNat_dvd_left.2 <| Nat.gcd_dvd_left n₂.natAbs d₂
have hd₁ := Int.ofNat_dvd.2 <| Nat.gcd_dvd_right n₁.natAbs d₁
have hd₂ := Int.ofNat_dvd.2 <| Nat.gcd_dvd_right n₂.natAbs d₂
rw [← Int.ediv_mul_cancel (Int.dvd_trans hd₂ (Int.dvd_mul_left ..)),
Int.mul_ediv_assoc _ hd₂, ← Int.ofNat_ediv, ← h.2, Int.ofNat_ediv,
← Int.mul_ediv_assoc _ hd₁, Int.mul_ediv_assoc' _ hn₁,
Expand Down
4 changes: 2 additions & 2 deletions Batteries/Data/String/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -922,14 +922,14 @@ theorem takeWhile (p : Char → Bool) : ∀ {s}, ValidFor l m r s →
ValidFor l (m.takeWhile p) (m.dropWhile p ++ r) (s.takeWhile p)
| _, ⟨⟩ => by
simp only [Substring.takeWhile, takeWhileAux_of_valid]
refine' .of_eq .. <;> simp
apply ValidFor.of_eq <;> simp
rw [← List.append_assoc, List.takeWhile_append_dropWhile]

theorem dropWhile (p : Char → Bool) : ∀ {s}, ValidFor l m r s →
ValidFor (l ++ m.takeWhile p) (m.dropWhile p) r (s.dropWhile p)
| _, ⟨⟩ => by
simp only [Substring.dropWhile, takeWhileAux_of_valid]
refine' .of_eq .. <;> simp
apply ValidFor.of_eq <;> simp
rw [Nat.add_assoc, ← utf8Len_append (m.takeWhile p), List.takeWhile_append_dropWhile]

-- TODO: takeRightWhile
Expand Down

0 comments on commit 869f2ad

Please sign in to comment.