cfahlgren1/math / lean /OAI /InformationTheory /Entanglement /LocalMemoryKernels.lean
cfahlgren1's picture
download
raw
3.6 kB
12
lemma visiblePrefix_init (k : ℕ) (h : Fin (k+1)→X) :
    Fin.init (visiblePrefix role pub x₀ r (k+1) h)=
      visiblePrefix role pub x₀ r k (Fin.init h) := by
proof · 2 lines
  funext i
  simp only [Fin.init,visiblePrefix,Fin.val_castSucc]
17
lemma visiblePrefix_idem (k : ℕ) (h : Fin k→X) :
    visiblePrefix role pub x₀ r k (visiblePrefix role pub x₀ r k h)=visiblePrefix role pub x₀ r k h := by
proof · 3 lines
  funext i
  dsimp only [visiblePrefix]
  split_ifs <;> rfl
23
def localStateAt (s₀ : S) (update : (k : ℕ) → (Fin k→X) → S → X → S) :
    (k : ℕ) → (Fin k→X) → S
body · 5 lines
  | 0, _ => s₀
  | k+1, h => if role k=r then
      update k (visiblePrefix role pub x₀ r k (Fin.init h))
        (localStateAt s₀ update k (Fin.init h)) (h (Fin.last k))
    else localStateAt s₀ update k (Fin.init h)
30
lemma localStateAt_visible (s₀ : S) (update : (k : ℕ) → (Fin k→X) → S → X → S)
    (k : ℕ) (h : Fin k→X) :
    localStateAt role pub x₀ r s₀ update k (visiblePrefix role pub x₀ r k h)=
      localStateAt role pub x₀ r s₀ update k h := by
proof · 7 lines
  induction k with
  | zero => rfl
  | succ k ih =>
    simp only [localStateAt,visiblePrefix_init,visiblePrefix_idem,ih]
    by_cases hr : role k=r
    · simp [hr,visiblePrefix]
    · simp only [hr,ite_false]
42
lemma localStateAt_measurable (s₀ : S) (update : (k : ℕ) → (Fin k→X) → S → X → S)
    (hupdate : ∀ k, Measurable (fun p : ((Fin k→X)×S)×X => update k p.1.1 p.1.2 p.2)) (k : ℕ) :
    Measurable (localStateAt role pub x₀ r s₀ update k) := by
proof · 11 lines
  induction k with
  | zero => exact measurable_const
  | succ k ih =>
    have hini : Measurable (Fin.init : (Fin (k+1)→X) → (Fin k→X)) := by
      apply Measurable.of_eval; intro i; exact measurable_pi_apply i.castSucc
    by_cases hr : role k=r
    · simp only [localStateAt,hr,ite_true]
      exact (hupdate k).comp
        ((((visiblePrefix_measurable role pub x₀ r k).comp hini).prodMk (ih.comp hini)).prodMk
          (measurable_pi_apply (Fin.last k)))
    · simpa only [localStateAt,hr,ite_false,Function.comp_def] using ih.comp hini
57
def memoryOutcomeKernel (s₀ : S) (update : (k : ℕ) → (Fin k→X) → S → X → S)
    (hupdate : ∀ k, Measurable (fun p : ((Fin k→X)×S)×X => update k p.1.1 p.1.2 p.2))
    (K : (k : ℕ) → Kernel ((Fin k→X)×S) X) (k : ℕ) : Kernel (Fin k→X) X :=
body · 2 lines
  (K k).comap (fun h => (visiblePrefix role pub x₀ r k h,localStateAt role pub x₀ r s₀ update k h))
    ((visiblePrefix_measurable role pub x₀ r k).prodMk (localStateAt_measurable role pub x₀ r s₀ update hupdate k))
62
lemma memoryOutcomeKernel_visible (s₀ : S) (update : (k : ℕ) → (Fin k→X) → S → X → S)
    (hupdate : ∀ k, Measurable (fun p : ((Fin k→X)×S)×X => update k p.1.1 p.1.2 p.2))
    (K : (k : ℕ) → Kernel ((Fin k→X)×S) X) (k : ℕ) (h : Fin k→X) :
    memoryOutcomeKernel role pub x₀ r s₀ update hupdate K k (visiblePrefix role pub x₀ r k h)=
      memoryOutcomeKernel role pub x₀ r s₀ update hupdate K k h := by
proof · 1 line
  simp only [memoryOutcomeKernel,Kernel.comap_apply,visiblePrefix_idem,localStateAt_visible]

Xet Storage Details

Size:
3.6 kB
·
Xet hash:
fe53ce43366ae9d5758f379bc39811241568b95b9ee108e12ca57f9f11cee008

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.