Zulip Chat Archive

Stream: Is there code for X?

Topic: Finite geometric sums


Mark Gerads (Nov 30 2021 at 13:20):

I am working on it because I was unable to find it. What I have so far:

import analysis.specific_limits
import analysis.normed_space.basic
import analysis.complex.basic
import data.complex.basic
import topology.algebra.infinite_sum
import analysis.special_functions.pow

noncomputable theory

open topological_space normed_space set
open_locale topological_space
open_locale classical big_operators nat
open real is_absolute_value finset cau_seq

namespace complex

lemma finiteGeometricSum (z:) (n:) (h:z1):((z^n-1)/(z-1)=∑ m in range n, z ^ m):=
begin
  induction n,
  simp,
  have h1 : ((z ^ n_n - 1) / (z - 1) + z ^ n_n = ( (m : ) in range n_n, z ^ m) + z ^ n_n),
  exact congr_fun (congr_arg has_add.add n_ih) (z ^ n_n),
  have h2 : (( (m : ) in range n_n, z ^ m) + z ^ n_n =  (m : ) in range n_n.succ, z ^ m),
  exact (sum_range_succ (λ (x : ), z ^ x) n_n).symm,
  -- have h3 : (z ^ n_n * (z - 1) = z ^ n_n * (z - 1)),
  -- exact rfl,
  have h4 : (z ^ n_n * z - z ^ n_n * 1 = z ^ n_n * (z - 1)),
  exact (mul_sub (z ^ n_n) z 1).symm,
  have h5 : (z ^ n_n * z = z ^ (n_n + 1)),
  exact mul_comm (z ^ n_n) z,
  have h6 : (z ^ (n_n + 1) - z ^ n_n * 1 = z ^ n_n * (z - 1)),
  --substitute h5 in h4

  --have h : (z ^ n_n * (z - 1) / (z - 1) = z ^ n_n),
  --have h : ((z ^ n_n.succ - 1) / (z - 1) = (z ^ n_n - 1) / (z - 1) + z ^ n_n),
end

end complex

Context: I need it to show that any [[size n geometric sum] of [an nth root of unity other than 1]] equals 0. This can be generalized to roots of unity outside the complex numbers.

Heather Macbeth (Nov 30 2021 at 13:22):

Have you seen lemmas like docs#geom_sum_mul ?

Mark Gerads (Nov 30 2021 at 13:22):

No. I will look now.

Mark Gerads (Nov 30 2021 at 13:27):

It looks almost like what I want. Thanks.

Mark Gerads (Nov 30 2021 at 13:35):

With the right import, this works

lemma finiteGeometricSum (z:) (n:) (h:z1):((z^n-1)/(z-1)=∑ m in range n, z ^ m):=
begin
  exact (geom_sum_eq h n).symm,
end

Mark Gerads (Nov 30 2021 at 13:37):

Yay, library_search!,.

Mark Gerads (Nov 30 2021 at 13:39):

The trouble with library_search is that it only searches the imports rather than all of mathlib.

Eric Rodriguez (Nov 30 2021 at 13:46):

ring_theory.roots_of_unity may be a nice file to check out, btw

Mark Gerads (Nov 30 2021 at 13:47):

I'll take a look then. :)

Kevin Buzzard (Nov 30 2021 at 17:51):

You can always run ./scripts/mk_all.sh on the command line and then import all if you want to search all of mathlib.


Last updated: Dec 20 2023 at 11:08 UTC