Skip to content

Commit 8ac310b

Browse files
committed
feat: add instances NeZero(n^0) for n : Nat and n : Int
This PR adds two missing `NeZero` instances for `n^0` where `n : Nat` and `n : Int`.
1 parent a73ebe8 commit 8ac310b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/Init/Data/Int/Pow.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ protected theorem pow_ne_zero {n : Int} {m : Nat} : n ≠ 0 → n ^ m ≠ 0 := b
5050

5151
instance {n : Int} {m : Nat} [NeZero n] : NeZero (n ^ m) := ⟨Int.pow_ne_zero (NeZero.ne _)⟩
5252

53+
instance {n : Int} : NeZero (n^0) := ⟨Int.one_ne_zero⟩
54+
5355
-- This can't be removed until the next update-stage0
5456
@[deprecated Nat.pow_pos (since := "2025-02-17")]
5557
abbrev _root_.Nat.pos_pow_of_pos := @Nat.pow_pos

src/Init/Data/Nat/Basic.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@ protected theorem two_pow_pos (w : Nat) : 0 < 2^w := Nat.pow_pos (by decide)
801801
instance {n m : Nat} [NeZero n] : NeZero (n^m) :=
802802
⟨Nat.ne_zero_iff_zero_lt.mpr (Nat.pow_pos (pos_of_neZero _))⟩
803803

804+
instance {n : Nat} : NeZero (n^0) := ⟨Nat.one_ne_zero⟩
805+
804806
protected theorem mul_pow (a b n : Nat) : (a * b) ^ n = a ^ n * b ^ n := by
805807
induction n with
806808
| zero => simp [Nat.pow_zero]

0 commit comments

Comments
 (0)