Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 17cba54

Browse files
committed
feat(data/int/basic): sign raised to an odd power (#7559)
Since sign is either -1, 0, or 1, it is unchanged when raised to an odd power. Co-authored-by: tb65536 <tb65536@users.noreply.github.com>
1 parent 3417ee0 commit 17cba54

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/data/int/basic.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,12 @@ theorem mul_sign : ∀ (i : ℤ), i * sign i = nat_abs i
818818
| 0 := mul_zero _
819819
| -[1+ n] := mul_neg_one _
820820

821+
@[simp]
822+
theorem sign_pow_bit1 (k : ℕ) : ∀ n : ℤ, n.sign ^ (bit1 k) = n.sign
823+
| (n+1:ℕ) := one_pow (bit1 k)
824+
| 0 := zero_pow (nat.zero_lt_bit1 k)
825+
| -[1+ n] := (neg_pow_bit1 1 k).trans (congr_arg (λ x, -x) (one_pow (bit1 k)))
826+
821827
theorem le_of_dvd {a b : ℤ} (bpos : 0 < b) (H : a ∣ b) : a ≤ b :=
822828
match a, b, eq_succ_of_zero_lt bpos, H with
823829
| (m : ℕ), ._, ⟨n, rfl⟩, H := coe_nat_le_coe_nat_of_le $

0 commit comments

Comments
 (0)