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.

(* Specifications: *)
Lemma PPO_is_compatible_rule: forall r, PPO_rule rank r -> compatible_rule r.
Lemma PPO_is_compatible_prog: PPO_prog -> compatible_prog.
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).
Lemma all_functions_in_prog (function_default : function) (proof_tree: cbv) : wf proof_tree -> forall p, In p (activations proof_tree) -> In (activation_function function_default p) (functions_of_prog prog).
Lemma sub_term_strict_incl (t: term) : incl (sub_terms_strict t) (sub_terms t).
Lemma sub_term_eq_or_strict (t1 t2: term) : In t1 (sub_terms t2) <-> t1 = t2 \/ In t1 (sub_terms_strict t2).
Lemma sub_term_le_size (t1 t2: term) : In t1 (sub_terms t2) -> t2 = t1 \/ term_size t1 < term_size t2.
Lemma sub_terms_strict_strict (t: term) : ~ In t (sub_terms_strict t).
Lemma sub_term_strict_lt_size (t1 t2: term) : In t1 (sub_terms_strict t2) -> term_size t1 < term_size t2.
Lemma PPO_value_is_sub_term (t v: term) : @term_value _ _ _ v -> (PPO rank t v <-> In t (sub_terms_strict v)).
Lemma PPO_value_lt_size (v v': value) : PPO rank (@term_from_value variable function constructor v) (@term_from_value _ _ _ v') -> value_size v < value_size v'.
Lemma length_sub_terms a : length (sub_terms a) = term_size a.
Lemma all_possible_subarguments_length (args: list term) : length (all_possible_subarguments args) = prodl (map (@term_size _ _ _) args).