File size: 2,266 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import OAI.Combinatorics.ContingencyTables.Transport.CompletionProposalLaw

namespace OAI

/-! # Identifying a complete transition law from its off-diagonal probabilities -/

namespace ContingencyTables.FirstSuccess

open scoped BigOperators
open ResidualMixture

variable {X : Type*} [Fintype X] [DecidableEq X]

/-- Normalization determines the remaining holding probability. -/
theorem law_ext_except (p q : RationalLaw X) (x : X)
    (h : βˆ€ y,yβ‰ x β†’ p.mass y=q.mass y) : p=q := by
  apply RationalLaw.ext
  funext y
  by_cases hy : y=x
  Β· subst y
    have hs : (βˆ‘ y,(p.mass y-q.mass y))=p.mass x-q.mass x := by
      apply Finset.sum_eq_single x
      Β· intro y _ hy
        rw [h y hy,sub_self]
      Β· simp
    rw [Finset.sum_sub_distrib,p.total,q.total,sub_self] at hs
    linarith
  Β· exact h y hy

end ContingencyTables.FirstSuccess

namespace ContingencyTables.CompletionTranslation

open scoped BigOperators Classical
open ResidualMixture FirstSuccess

noncomputable section
variable {X I J : Type*} [Fintype X] [Fintype I] [Fintype J] [DecidableEq X]
variable (R : X β†’ Option I β†’ β„•) (P : X β†’ Option J β†’ β„•)
variable [βˆ€ x,Nonempty (Table (R x) (P x))]

omit [βˆ€ x,Nonempty (Table (R x) (P x))] in
/-- Only the proposal distribution at the current state is observed. -/
lemma completionStepLaw_proposal_at (p q : X β†’ RationalLaw (Option X))
    (draw : (z : X) β†’ RationalLaw (Table (R z) (P z))) (x : X) (h : p x=q x) :
    completionStepLaw R P p draw x=completionStepLaw R P q draw x := by
  unfold completionStepLaw
  rw [h]

/-- This identifies the actual draw-and-test transition, including holds;
no independent reversibility or stationarity assertion is imposed on it. -/
theorem uniformCompletionStep_eq (w : X β†’ β„š) (hw : βˆ€ y,0 ≀ w y)
    (htotal : βˆ‘ y,w y ≀ 1) (x : X) (K : RationalLaw X)
    (hK : βˆ€ y,yβ‰ x β†’ K.mass y=w y*(acceptedCount R P x y:β„š)/(blockCount R P x:β„š)) :
    completionStepLaw R P (fun _ => proposalLaw w hw htotal)
      (fun z => uniformLaw (Ξ± := Table (R z) (P z))) x=K := by
  apply law_ext_except _ _ x
  intro y hy
  rw [completionStepLaw_mass_ne R P w hw htotal _ x y hy.symm,uniformAcceptedMass,hK y hy]
  ring

end
end ContingencyTables.CompletionTranslation

end OAI