The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V01. The language of Mathlib

Mathlib.Logic.Function.Iterate

44 declarations. Mathlib docs · Source

Iterations of a function

In this file we prove simple properties of Nat.iterate f n a.k.a. f^[n]:

  • iterate_zero, iterate_succ, iterate_succ', iterate_add, iterate_mul: formulas for f^[0], f^[n+1] (two versions), f^[n+m], and f^[n*m];

  • iterate_id : id^[n]=id;

  • Injective.iterate, Surjective.iterate, Bijective.iterate : iterates of an injective/surjective/bijective function belong to the same class;

  • LeftInverse.iterate, RightInverse.iterate, Commute.iterate_left, Commute.iterate_right, Commute.iterate_iterate: some properties of pairs of functions survive under iterations

  • iterate_fixed, Function.Semiconj.iterate_*, Function.Semiconj₂.iterate: if f fixes a point (resp., semiconjugates unary/binary operations), then so does f^[n].

def Nat.iterate E1 #

{α : Sort u} → (α → α) → ℕ → α → α

Iterate a function.

def «term_^[_]» E1 #

Lean.TrailingParserDescr

Iterate a function.

theorem Function.iterate_zero E0 #

∀ {α : Type u} (f : α → α), f^[0] = id

theorem Function.iterate_zero_apply E0 #

∀ {α : Type u} (f : α → α) (x : α), f^[0] x = x

theorem Function.iterate_succ E0 #

∀ {α : Type u} (f : α → α) (n : ℕ), f^[n.succ] = f^[n] ∘ f

theorem Function.iterate_succ_apply E0 #

∀ {α : Type u} (f : α → α) (n : ℕ) (x : α), f^[n.succ] x = f^[n] (f x)

theorem Function.iterate_id E0 #

∀ {α : Type u} (n : ℕ), id^[n] = id

theorem Function.iterate_add E1 #

∀ {α : Type u} (f : α → α) (m n : ℕ), f^[m + n] = f^[m] ∘ f^[n]

theorem Function.iterate_add_apply E0 #

∀ {α : Type u} (f : α → α) (m n : ℕ) (x : α), f^[m + n] x = f^[m] (f^[n] x)

theorem Function.iterate_one E0 #

∀ {α : Type u} (f : α → α), f^[1] = f

theorem Function.iterate_mul E1 #

∀ {α : Type u} (f : α → α) (m n : ℕ), f^[m * n] = f^[m] ^[n]

theorem Function.iterate_fixed E1 #

∀ {α : Type u} {f : α → α} {x : α}, f x = x → ∀ (n : ℕ), f^[n] x = x

theorem Function.iterate_invariant E1 #

∀ {α : Type u} {β : Type v} {f : α → α} {g : α → β}, g ∘ f = g → ∀ (n : ℕ), g ∘ f^[n] = g

If a function g is invariant under composition with a function f (i.e., g ∘ f = g), then g is invariant under composition with any iterate of f.

theorem Function.Injective.iterate E1 #

∀ {α : Type u} {f : α → α}, Function.Injective f → ∀ (n : ℕ), Function.Injective f^[n]

theorem Function.Surjective.iterate E1 #

∀ {α : Type u} {f : α → α}, Function.Surjective f → ∀ (n : ℕ), Function.Surjective f^[n]

theorem Function.Bijective.iterate E1 #

∀ {α : Type u} {f : α → α}, Function.Bijective f → ∀ (n : ℕ), Function.Bijective f^[n]

theorem Function.Semiconj.iterate_right E1 #

∀ {α : Type u} {β : Type v} {f : α → β} {ga : α → α} {gb : β → β},
  Function.Semiconj f ga gb → ∀ (n : ℕ), Function.Semiconj f ga^[n] gb^[n]

theorem Function.Semiconj.iterate_left E1 #

∀ {α : Type u} {f : α → α} {g : ℕ → α → α},
  (∀ (n : ℕ), Function.Semiconj f (g n) (g (n + 1))) → ∀ (n k : ℕ), Function.Semiconj f^[n] (g k) (g (n + k))

theorem Function.Commute.iterate_right E1 #

∀ {α : Type u} {f g : α → α}, Function.Commute f g → ∀ (n : ℕ), Function.Commute f g^[n]

theorem Function.Commute.iterate_left E1 #

∀ {α : Type u} {f g : α → α}, Function.Commute f g → ∀ (n : ℕ), Function.Commute f^[n] g

theorem Function.Commute.iterate_iterate E1 #

∀ {α : Type u} {f g : α → α}, Function.Commute f g → ∀ (m n : ℕ), Function.Commute f^[m] g^[n]

theorem Function.Commute.iterate_eq_of_map_eq E0 #

∀ {α : Type u} {f g : α → α}, Function.Commute f g → ∀ (n : ℕ) {x : α}, f x = g x → f^[n] x = g^[n] x

theorem Function.Commute.comp_iterate E1 #

∀ {α : Type u} {f g : α → α}, Function.Commute f g → ∀ (n : ℕ), (f ∘ g)^[n] = f^[n] ∘ g^[n]

theorem Function.Commute.iterate_self E1 #

∀ {α : Type u} (f : α → α) (n : ℕ), Function.Commute f^[n] f

theorem Function.Commute.self_iterate E1 #

∀ {α : Type u} (f : α → α) (n : ℕ), Function.Commute f f^[n]

theorem Function.Commute.iterate_iterate_self E1 #

∀ {α : Type u} (f : α → α) (m n : ℕ), Function.Commute f^[m] f^[n]

theorem Function.Semiconj₂.iterate E1 #

∀ {α : Type u} {f : α → α} {op : α → α → α}, Function.Semiconj₂ f op op → ∀ (n : ℕ), Function.Semiconj₂ f^[n] op op

theorem Function.iterate_succ' E1 #

∀ {α : Type u} (f : α → α) (n : ℕ), f^[n.succ] = f ∘ f^[n]

theorem Function.iterate_succ_apply' E1 #

∀ {α : Type u} (f : α → α) (n : ℕ) (x : α), f^[n.succ] x = f (f^[n] x)

theorem Function.iterate_pred_comp_of_pos E1 #

∀ {α : Type u} (f : α → α) {n : ℕ}, 0 < n → f^[n.pred] ∘ f = f^[n]

theorem Function.comp_iterate_pred_of_pos E1 #

∀ {α : Type u} (f : α → α) {n : ℕ}, 0 < n → f ∘ f^[n.pred] = f^[n]

def Function.Iterate.rec E1 #

{α : Type u} →
  (motive : α → Sort u_1) →
    {a : α} → motive a → {f : α → α} → ((a : α) → motive a → motive (f a)) → (n : ℕ) → motive (f^[n] a)

A recursor for the iterate of a function.

theorem Function.Iterate.rec_zero E1 #

∀ {α : Type u} (motive : α → Sort u_1) {f : α → α} (app : (a : α) → motive a → motive (f a)) {a : α} (arg : motive a),
  Function.Iterate.rec motive arg app 0 = arg

theorem Function.LeftInverse.iterate E1 #

∀ {α : Type u} {f g : α → α}, Function.LeftInverse g f → ∀ (n : ℕ), Function.LeftInverse g^[n] f^[n]

theorem Function.RightInverse.iterate E1 #

∀ {α : Type u} {f g : α → α}, Function.RightInverse g f → ∀ (n : ℕ), Function.RightInverse g^[n] f^[n]

theorem Function.iterate_comm E1 #

∀ {α : Type u} (f : α → α) (m n : ℕ), f^[n] ^[m] = f^[m] ^[n]

theorem Function.iterate_commute E1 #

∀ {α : Type u} (m n : ℕ), Function.Commute (fun f ↦ f^[m]) fun f ↦ f^[n]

theorem Function.iterate_add_eq_iterate E1 #

∀ {α : Type u} {f : α → α} {m n : ℕ} {a : α}, Function.Injective f → (f^[m + n] a = f^[n] a ↔ f^[m] a = a)

theorem Function.iterate_cancel_of_add E1 #

∀ {α : Type u} {f : α → α} {m n : ℕ} {a : α}, Function.Injective f → f^[m + n] a = f^[n] a → f^[m] a = a

Alias of the forward direction of Function.iterate_add_eq_iterate.

theorem Function.iterate_cancel E1 #

∀ {α : Type u} {f : α → α} {m n : ℕ} {a : α}, Function.Injective f → f^[m] a = f^[n] a → f^[m - n] a = a

theorem Function.involutive_iff_iter_2_eq_id E1 #

∀ {α : Sort u_1} {f : α → α}, Function.Involutive f ↔ f^[2] = id

theorem List.foldl_const E1 #

∀ {α : Type u} {β : Type v} (f : α → α) (a : α) (l : List β), List.foldl (fun b x ↦ f b) a l = f^[l.length] a

theorem List.foldr_const E1 #

∀ {α : Type u} {β : Type v} (f : β → β) (b : β) (l : List α), List.foldr (fun x ↦ f) b l = f^[l.length] b

theorem Pi.map_iterate E0 #

∀ {ι : Type u_1} {α : ι → Type u_2} (f : (i : ι) → α i → α i) (n : ℕ), (Pi.map f)^[n] = Pi.map fun i ↦ (f i)^[n]