Skip to content

Commit 0a325a7

Browse files
kim-emclaude
andcommitted
feat: add Nat.cast_id and grind attribute to Int.cast_id
Adds in a new file 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 0a325a7

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-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.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public import Init.Data.Nat.Power2
2020
public import Init.Data.Nat.Linear
2121
public import Init.Data.Nat.SOM
2222
public import Init.Data.Nat.Lemmas
23+
public import Init.Data.Nat.Cast
2324
public import Init.Data.Nat.Mod
2425
public import Init.Data.Nat.Lcm
2526
public import Init.Data.Nat.Compare

src/Init/Data/Nat/Cast.lean

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/-
2+
Copyright (c) 2024 Lean FRO. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Kim Morrison
5+
-/
6+
module
7+
8+
prelude
9+
public import Init.Data.Cast
10+
public import Init.Data.Nat.Lemmas
11+
12+
public section
13+
14+
namespace Nat
15+
16+
@[simp, norm_cast, grind =] theorem cast_id (n : Nat) : Nat.cast n = n := rfl
17+
18+
end Nat

0 commit comments

Comments
 (0)