Definition compatible_rule (r:rule) : Prop :=
match r with
| rule_intro f _ t => forall f', In f' (functions_of_term t) -> rank f' <= rank f
end.
Definition compatible_prog : Prop :=
forall r, In r prog -> compatible_rule r.

Lemma gary_seven i s p c1 f lt c2 v:
let proof_tree := cbv_update i s p c1 (fapply f lt) c2 v in
compatible_prog ->
wf proof_tree ->
PPO_prog ->
length (activations proof_tree) <= gary_seven_poly (A_T proof_tree).