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 contextual_consi_shorten {ora: RandomOracle}: forall (n: nat) (d: RandomHistory -> Prop) (h h0: RandomHistory),
h n <> None ->
h0 n <> None ->
contextual_consi d h ->
contextual_consi d h0 ->
history_coincide n h h0 ->
n_conflict_history n h h0 ->
contextual_consi d (fstn_history n h).