Section Algebra.
(* Compatibility with evaluation *)
Hint Extern 5 =>
match goal with
| [ |- (Pos.max ?x ?y <= ?z)%positive ] =>
apply Pos.max_case_strong; intros; lia
| [ |- (?z <= Pos.max ?x ?y)%positive ] =>
apply Pos.max_case_strong; intros; lia
| [ |- (Pos.max ?x ?y < ?z)%positive ] =>
apply Pos.max_case_strong; intros; lia
| [ |- (?z < Pos.max ?x ?y)%positive ] =>
apply Pos.max_case_strong; intros; lia
| _ => zify; omega
end : core.
Hint Resolve Pos.le_max_r Pos.le_max_l : core.
Hint Constructors valid linear : core.
(* Compatibility of validity w.r.t algebraic operations *)
(* Compatibility of linearity wrt to linear operations *)

Lemma poly_add_linear_compat : forall kl kr pl pr, linear kl pl -> linear kr pr ->
linear (Pos.max kl kr) (poly_add pl pr).