(* Definition join {ora: RandomOracle} {A: Type} (v1 v2 v: RandomVariable A): Prop := forall h, (v1 h = None /\ v2 h = v h) \/ (v2 h = None /\ v1 h = v h).  Definition Forall_RandomHistory {ora: RandomOracle} {A: Type} (P: A -> Prop) (v: RandomVariable A): Prop := forall h, match v h with | None => True | Some a => P a end. *)
exists (fun h' => forall n, h n = h' n).
constructor.
hnf; intros; simpl in *.
destruct H as [n [? ?]].
specialize (H0 n).
specialize (H1 n).
hnf in H2.
destruct (h n); rewrite <- H0, <- H1 in H2; auto.
Defined.
Definition unit_space_anti_chain {ora: RandomOracle}: HistoryAntiChain := singleton_history_anti_chain (fin_history nil).
Definition filter_anti_chain {ora: RandomOracle} (filter: RandomHistory -> Prop) (d: HistoryAntiChain): HistoryAntiChain.
exists (fun h => d h /\ filter h).
constructor.
destruct d as [d [H]].
hnf; simpl; intros.
apply (H h1 h2 H0); tauto.
Defined.
Definition covered_by {ora: RandomOracle} (h: RandomHistory) (d: HistoryAntiChain): Prop :=
exists h', prefix_history h' h /\ d h'.
Definition n_bounded_covered_by {ora: RandomOracle} (n: nat) (h: RandomHistory) (d: HistoryAntiChain): Prop :=
exists h', n_bounded_prefix_history n h' h -> d h'.
Definition future_anti_chain {ora: RandomOracle} (present future: HistoryAntiChain): Prop :=
forall h, future h -> covered_by h present.
Definition n_bounded_future_anti_chain {ora: RandomOracle} (n: nat) (present future: HistoryAntiChain): Prop :=
forall h, future h -> n_bounded_covered_by n h present.
Definition bounded_future_anti_chain {ora: RandomOracle} (present future: HistoryAntiChain): Prop :=
exists n, n_bounded_future_anti_chain n present future.
Definition same_covered_anti_chain {ora: RandomOracle} (d1 d2: HistoryAntiChain): Prop :=
forall h, is_inf_history h ->
((exists h', (prefix_history h' h \/ strict_conflict_history h' h) /\ d1 h') <->
(exists h', (prefix_history h' h \/ strict_conflict_history h' h) /\ d2 h')).

Lemma anti_chain_not_comparable {ora: RandomOracle}: forall (d: HistoryAntiChain) h1 h2,
d h1 ->
d h2 ->
prefix_history h1 h2 ->
h1 = h2.