Hint Resolve lt_0_pow.
Hint Rewrite mult_1_l.
Fixpoint first_activations_at_given_rank (rk: nat) (proof_tree : cbv) : list cbv :=
match proof_tree with
| cbv_constr lp _ _ _ _ => flat_map (first_activations_at_given_rank rk) lp
| cbv_split lp p _ _ _ _ => first_activations_at_given_rank rk p ++ flat_map (first_activations_at_given_rank rk) lp
| cbv_update _ _ p _ (fapply f _) _ _ as p' => if eq_nat_dec rk (rank f)
then [ p' ]
else first_activations_at_given_rank rk p
| _ => [] (* cbv_read and ill-formed cbv_update *)
end.
Definition activation_function (function_default : function) (p: cbv) :=
match p with
| cbv_update _ _ _ _ (fapply f _) _ _ => f
| _                                   => function_default
end.

Lemma first_activations_at_given_rank_rank rk p p' :
In p' (first_activations_at_given_rank rk p) ->
rk = activation_rank rank p'.