Skip to content

Commit fc1e7a2

Browse files
kim-emclaude
andcommitted
feat: add Nat.cast_id and grind attribute to Int.cast_id
Adds `Nat.cast_id` to `Init/Data/Nat/Lemmas.lean` with `simp`, `norm_cast`, and `grind =` attributes. Also adds `grind =` to the existing `Int.cast_id`. 🤖 Prepared with Claude Code Co-Authored-By: Claude <[email protected]>
1 parent 19e1fe5 commit fc1e7a2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Init/Data/Int/LemmasAux.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ theorem natCast_succ_pos (n : Nat) : 0 < (n.succ : Int) := natCast_pos.2 n.succ_
6262

6363
@[simp high] theorem natCast_nonpos_iff {n : Nat} : (n : Int) ≤ 0 ↔ n = 0 := by omega
6464

65-
@[simp, norm_cast] theorem cast_id {n : Int} : Int.cast n = n := rfl
65+
@[simp, norm_cast, grind =] theorem cast_id {n : Int} : Int.cast n = n := rfl
6666

6767
@[simp] theorem ble'_eq_true (a b : Int) : (Int.ble' a b = true) = (a ≤ b) := by
6868
cases a <;> cases b <;> simp [Int.ble'] <;> omega

src/Init/Data/Nat/Lemmas.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public import Init.Data.Nat.Log2
1212
import all Init.Data.Nat.Log2
1313
public import Init.Data.Nat.Power2
1414
public import Init.Data.Nat.Mod
15+
public import Init.Data.Cast
1516
import Init.TacticsExtra
1617
import Init.BinderPredicates
1718

@@ -1800,3 +1801,7 @@ instance decidableExistsFin (P : Fin n → Prop) [DecidablePred P] : Decidable (
18001801
decidable_of_iff (∃ k, k < n ∧ ((h: k < n) → P ⟨k, h⟩))
18011802
⟨fun ⟨k, a⟩ => Exists.intro ⟨k, a.left⟩ (a.right a.left),
18021803
fun ⟨i, e⟩ => Exists.intro i.val ⟨i.isLt, fun _ => e⟩⟩
1804+
1805+
/-! ### cast -/
1806+
1807+
@[simp, norm_cast, grind =] theorem cast_id (n : Nat) : Nat.cast n = n := rfl

0 commit comments

Comments
 (0)