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 fin_history_n_history {ora: RandomOracle}: forall h,
is_fin_history h ->
exists n, is_n_history n h.