math / data /lean /OAI /Probability /FreeIsing /Estimates /FiniteChain.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.29 kB
import Mathlib
namespace OAI
namespace Problem367.FiniteChain
variable {A : Type*}
def weight (K : A β†’ A β†’ ℝ) : (n : β„•) β†’ A β†’ (Fin n β†’ A) β†’ ℝ
| 0, _, _ => 1
| n + 1, a, x => K a (x 0) * weight K n (x 0) (Fin.tail x)
def endpoint : (n : β„•) β†’ A β†’ (Fin n β†’ A) β†’ A
| 0, a, _ => a
| n + 1, _, x => endpoint n (x 0) (Fin.tail x)
@[simp] theorem weight_zero (K : A β†’ A β†’ ℝ) (a : A) (x : Fin 0 β†’ A) :
weight K 0 a x = 1 := rfl
@[simp] theorem endpoint_zero (a : A) (x : Fin 0 β†’ A) :
endpoint 0 a x = a := rfl
@[simp] theorem weight_cons (K : A β†’ A β†’ ℝ) (n : β„•) (a b : A) (x : Fin n β†’ A) :
weight K (n + 1) a (Fin.cons b x) = K a b * weight K n b x := by
simp [weight]
@[simp] theorem endpoint_cons (n : β„•) (a b : A) (x : Fin n β†’ A) :
endpoint (n + 1) a (Fin.cons b x) = endpoint n b x := by
simp [endpoint]
theorem weight_eq_prod (K : A β†’ A β†’ ℝ) (n : β„•) (a : A) (x : Fin n β†’ A) :
weight K n a x = ∏ i : Fin n, K ((Fin.cons a x : Fin (n+1) β†’ A) i.castSucc) (x i) := by
induction n generalizing a with
| zero => simp
| succ n ih =>
rw [weight, Fin.prod_univ_succ, ih]
simp [Fin.tail]
theorem endpoint_eq_last (n : β„•) (a : A) (x : Fin n β†’ A) :
endpoint n a x = (Fin.cons a x : Fin (n+1) β†’ A) (Fin.last n) := by
induction n generalizing a with
| zero => rfl
| succ n ih =>
rw [endpoint, ih]
simp
theorem weight_nonneg (K : A β†’ A β†’ ℝ) (hK : βˆ€ a b, 0 ≀ K a b)
(n : β„•) (a : A) (x : Fin n β†’ A) : 0 ≀ weight K n a x := by
induction n generalizing a with
| zero => simp
| succ n ih => exact mul_nonneg (hK _ _) (ih _ _)
variable [Fintype A]
theorem sum_cons (n : β„•) (f : (Fin (n+1) β†’ A) β†’ ℝ) :
βˆ‘ x, f x = βˆ‘ a, βˆ‘ x : Fin n β†’ A, f (Fin.cons a x) := by
rw [← (Fin.consEquiv (fun _ : Fin (n+1) => A)).sum_comp f]
rw [Fintype.sum_prod_type]
rfl
def expectation (K : A β†’ A β†’ ℝ) (n : β„•) (f : A β†’ ℝ) (a : A) : ℝ :=
βˆ‘ x : Fin n β†’ A, weight K n a x * f (endpoint n a x)
@[simp] theorem expectation_zero (K : A β†’ A β†’ ℝ) (f : A β†’ ℝ) (a : A) :
expectation K 0 f a = f a := by
simp [expectation]
theorem expectation_succ (K : A β†’ A β†’ ℝ) (n : β„•) (f : A β†’ ℝ) (a : A) :
expectation K (n+1) f a = βˆ‘ b, K a b * expectation K n f b := by
unfold expectation
rw [sum_cons]
simp only [weight_cons, endpoint_cons, mul_assoc, Finset.mul_sum]
theorem expectation_eigenfunction (K : A β†’ A β†’ ℝ) (f : A β†’ ℝ) (r : ℝ)
(hf : βˆ€ a, βˆ‘ b, K a b * f b = r * f a) (n : β„•) (a : A) :
expectation K n f a = r^n * f a := by
induction n generalizing a with
| zero => simp
| succ n ih =>
rw [expectation_succ]
simp_rw [ih]
calc
βˆ‘ b, K a b * (r ^ n * f b) = r ^ n * βˆ‘ b, K a b * f b := by
rw [Finset.mul_sum]
apply Finset.sum_congr rfl
intro b hb
ring
_ = r ^ (n+1) * f a := by rw [hf, pow_succ]; ring
theorem sum_weight (K : A β†’ A β†’ ℝ) (hK : βˆ€ a, βˆ‘ b, K a b = 1)
(n : β„•) (a : A) : βˆ‘ x : Fin n β†’ A, weight K n a x = 1 := by
have h := expectation_eigenfunction K (fun _ => 1) 1 (by simpa using hK) n a
simpa [expectation] using h
end Problem367.FiniteChain
end OAI