Skip to main content

If u(n) tends to a, then 7u(n) tends to 7a

In Lean, a sequence \(u_0, u_1, u_2, ...\) can be represented by a function \(u : ℕ → ℝ\) such that \(u(n)\) is the term \(u_n\).

We define that \(u\) tends to \(a\) by

   def tendsTo : (  )    Prop :=
     fun u c   ε > 0,  N,  n  N, |u n - c| < ε

Prove that if \(u_n\) tends to \(a\), then \(7u\_n\) tends to \(7a\).

To do this, complete the following Lean4 theory:

import Mathlib.Tactic

variable {u :   }
variable {a : }

def tendsTo : (  )    Prop :=
  fun u c   ε > 0,  N,  n  N, |u n - c| < ε

example
  (h : tendsTo u a)
  : tendsTo (fun n  7 * u n) (7 * a) :=
by sorry

Read more…

Pigeonhole principle

Prove the pigeonhole principle; that is, if \(S\) is a finite set and \(T\) and \(U\) are subsets of \(S\) such that the number of elements of \(S\) is less than the sum of the number of elements of \(T\) and \(U\), then the intersection of \(T\) and \(U\) is non-empty.

To do this, complete the following Lean4 theory:

import Mathlib.Data.Finset.Card

open Finset

variable [DecidableEq α]
variable {s t u : Finset α}

set_option pp.fieldNotation false

example
  (hts : t  s)
  (hus : u  s)
  (hstu : card s < card t + card u)
  : Finset.Nonempty (t  u) :=
by sorry

Read more…

If f ∘ f is bijective, then f is bijective

Prove that if \(f ∘ f\) is bijective, then \(f\) is bijective.

To do this, complete the following Lean4 theory:

import Mathlib.Tactic
open Function

variable {X Y Z : Type}
variable  {f : X  Y}
variable  {g : Y  Z}

example
  (f : X  X)
  (h : Bijective (f  f))
  : Bijective f :=
by sorry

Read more…

Proofs of ∑k<n. 2ᵏ = 2ⁿ-1

Prove that \[ 1 + 2 + 2^2 + 2^3 + ... + 2^{n-1} = 2^n - 1 \]

To do this, complete the following Lean4 theory:

import Mathlib.Tactic

open Finset Nat

variable (n : )

example :
   k in range n, 2^k = 2^n - 1 :=
by sorry

Read more…

Proofs of "∑i<n. i = n(n-1)/2"

Gauss's formula for the sum of the first natural numbers is \[ 0 + 1 + 2 + ... + (n-1) = \dfrac{n(n-1)}{2} \] that is, \[ \sum_{i < n} i = \dfrac{n(n-1)}{2} \]

In a previous exercise, this formula was proven by induction. Another way to prove it, without using induction, is the following: The sum can be written in two ways \begin{align} S &= &0 &+ &1 &+ &2 &+ ... &+ &(n-3) &+ &(n-2) &+ &(n-1) \newline S &= &(n-1) &+ &(n-2) &+ &(n-3) &+ ... &+ &2 &+ &1 &+ &0 \end{align} By adding, we observe that each pair of numbers in the same column sums to (n-1), and since there are n columns in total, it follows that \[ 2S = n(n-1) \] which proves the formula.

Prove Gauss's formula by following the above procedure.

To do this, complete the following Lean4 theory:

import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Tactic

open Finset Nat

variable (n i : )

example :
   i  range n, i = n * (n - 1) / 2 :=
by sorry

Read more…

Proofs of "If p > -1, then (1+p)ⁿ ≥ 1+np"

Let \(p ∈ ℝ\) and \(n ∈ ℕ\). Prove that if \(p > -1\), then \[ (1 + p)^n ≥ 1 + np \]

To do this, complete the following Lean4 theory:

import Mathlib.Data.Real.Basic
import Mathlib.Tactic

open Nat

variable (p : )
variable (n : )

example
  (h : p > -1)
  : (1 + p)^n  1 + n*p :=
by sorry

Read more…

Proofs of 0³+1³+2³+3³+···+n³ = (n(n+1)/2)²

Prove that the sum of the first cubes \[ 0^3 + 1^3 + 2^3 + 3^3 + ··· + n^3 \] is \[ \dfrac{n(n+1)}{2}^2 \]

To do this, complete the following Lean4 theory:

import Mathlib.Data.Nat.Defs
import Mathlib.Tactic

open Nat

variable (n : )

def sumCubes :   
  | 0   => 0
  | n+1 => sumCubes n + (n+1)^3

example :
  4 * sumCubes n = (n*(n+1))^2 :=
by sorry

Read more…

Proofs of a+aq+aq²+···+aqⁿ = a(1-qⁿ⁺¹)/(1-q)

Prove that if \(q ≠ 1\), then the sum of the terms of the geometric progression \[ a + aq + aq^2 + ··· + aq^n \] is \[ \dfrac{a(1 - q^{n+1})}{1 - q} \]

To do this, complete the following Lean4 theory:

import Mathlib.Data.Nat.Defs
import Mathlib.Tactic

open Nat

variable (n : )
variable (a q : )

def sumGP :       
  | a, _, 0     => a
  | a, q, n + 1 => sumGP a q n + (a * q^(n + 1))

example
  (h : q  1)
  : sumGP a q n = a * (1 - q^(n + 1)) / (1 - q) :=
by sorry

Read more…

Proofs of a+(a+d)+(a+2d)+···+(a+nd)=(n+1)(2a+nd)/2

Prove that the sum of the terms of the arithmetic progression \[ a + (a + d) + (a + 2d) + ··· + (a + nd) \] is \[ \dfrac{(n + 1)(2a + nd)}{2} \]

To do this, complete the following Lean4 theory:

import Mathlib.Data.Nat.Defs
import Mathlib.Tactic

open Nat

variable (n : )
variable (a d : )

def sumAP :       
  | a, _, 0     => a
  | a, d, n + 1 => sumAP a d n + (a + (n + 1) * d)

example :
  2 * sumAP a d n = (n + 1) * (2 * a + n * d) :=
by sorry

Read more…