Zulip Chat Archive
Stream: mathlib4
Topic: Definition of two relational random sequence
haotian liu (Mar 18 2024 at 02:28):
I want to define two random sequences, S and X, where the value of Sk is randomly drawn with equal probability from {1, 2, ..., N}, and Xk+1 = Xk - a * Sk, where 0 < a < 1.
How should I define the two random sequences S and X in Lean?
Or are there any documents in Lean that I can refer to?
Yaël Dillies (Mar 18 2024 at 06:48):
The idea is to define k ↦ S k as being drawn from the uniform distribution on {1, ..., N}, then define X by recursion using it.
Yaël Dillies (Mar 18 2024 at 06:48):
Is S an infinite sequence, or is it finite?
haotian liu (Mar 18 2024 at 08:00):
S is a finite sequence.
haotian liu (Mar 20 2024 at 02:11):
I still have a question. Suppose there is a random variable X, which follows the distribution μ. Are there any relevant theorems about random sampling in Mathlib?
variable {Ω : Type*} [MeasurableSpace Ω]
variable {X : Ω → ℝ} {μ : Measure Ω}
haotian liu (Mar 25 2024 at 03:05):
Yaël Dillies said:
The idea is to define
k ↦ S kas being drawn from the uniform distribution on{1, ..., N}, then defineXby recursion using it.
I still have a question, how should i write the recursion in Lean?
Yaël Dillies (Mar 25 2024 at 06:20):
Something like
def X (S : ℕ → ℝ) (a : ℝ) : ℕ → ℝ
| 0 => sorry -- You didn't tell what you wanted here
| k + 1 => X k - a * S k
Yaël Dillies (Mar 25 2024 at 06:20):
Maybe you will want to replace ℕ → ℝ with Fin n → ℝ for some n that you didn't specify to me
haotian liu (Mar 25 2024 at 07:37):
OK, Thank you very much!
Last updated: May 02 2025 at 03:31 UTC