Fixpoint activations (proof_tree : cbv) : list cbv :=
match proof_tree with
| cbv_constr lp _ _ _ _ => flat_map activations lp
| cbv_split lp p _ _ _ _ => activations p ++ flat_map activations lp
| cbv_update _ _ p _ _ _ _ as p' => p' :: activations p
| cbv_read _ _ _ => []
end.
Fixpoint activations_cache_order (proof_tree : cbv) : list cbv :=
match proof_tree with
| cbv_constr lp _ _ _ _ => revflatten (map activations_cache_order lp)
| cbv_split lp p _ _ _ _ => activations_cache_order p ++ revflatten (map activations_cache_order lp)
| cbv_update _ _ p _ _ _ _ as p' => p' :: activations_cache_order p
| cbv_read _ _ _ => []
end.

Lemma activations_are_subtrees: forall p pi:cbv,
In p (activations pi) -> In p (sub_trees pi).