Definition max_anti_chain_same_covered {ora: RandomOracle}: forall (d1 d2: HistoryAntiChain),
  is_max_anti_chain d1 ->
  is_max_anti_chain d2 ->
  same_covered_anti_chain d1 d2.Definition contextual_consi {ora: RandomOracle} (d: RandomHistory -> Prop) (h: RandomHistory): Prop :=
  forall h', d h' -> conflict_history h h' -> False.Definition nth_layer_pre_extension {ora: RandomOracle} (n: nat) (d: RandomHistory -> Prop): RandomHistory -> Prop :=
  fun h => d h \/ (is_n_history n h /\ contextual_consi d h).Fixpoint n_layers_pre_extension {ora: RandomOracle} (n: nat) (d: RandomHistory -> Prop): RandomHistory -> Prop :=
  match n with
  | 0 => d
  | S n => nth_layer_pre_extension n (n_layers_pre_extension n d)
  end.Definition finite_layers_pre_extension {ora: RandomOracle} (d: RandomHistory -> Prop): RandomHistory -> Prop :=
  fun h => exists n, n_layers_pre_extension n d h.Definition max_pre_extension {ora: RandomOracle} (d: RandomHistory -> Prop): RandomHistory -> Prop :=
  fun h => finite_layers_pre_extension d h \/ (is_inf_history h /\ contextual_consi (finite_layers_pre_extension d) h).Definition guarded_covered {ora: RandomOracle} (P: RandomHistory -> Prop) (d: RandomHistory -> Prop): Prop :=
  forall h, P h -> contextual_consi d h -> d h.Definition nth_layer_covered {ora: RandomOracle} (n: nat) (d: RandomHistory -> Prop): Prop :=
  guarded_covered (is_n_history n) d.

Lemma finite_layers_pre_extension_spec {ora: RandomOracle}: forall (d: RandomHistory -> Prop), history_set_consi d -> history_set_consi (finite_layers_pre_extension d) /\ guarded_covered is_fin_history (finite_layers_pre_extension d).