Definition activation_rank (p : cbv) : nat :=
  match p with
  | cbv_update _ _ _ _ (fapply f _) _ _ => rank f
  | _                                   => 0
  end.

Lemma same_rank_same_ppo vv ff cc (t : term vv ff cc) s rk rk': (forall f, In f (functions_of_term t) -> rk f = rk' f) -> (forall f, In f (functions_of_term s) -> rk f = rk' f) -> PPO rk t s -> PPO rk' t s.