Library NumAnalysis.Algebra.Monoid.Monomial_order
This file is part of the Rocq Numerical Analysis library
Copyright (C) Boldo, Clément, Martin, Mayero, Mouhcine
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
COPYING file for more details.
Support for monomial orders.
Monomial orders are homogeneous binary relations on finite families of an
Abelian monoid that are strict or nonstrict total orders, and are compatible
with the operation of the monoid.
Let G : AbelianMonoid.
Let R : G → G → Prop be an homogeneous binary relation on G.
In lemma names, shorter forms are used (definitions keep their full names):
Let Rn : 'G^n → 'G^n → Prop be an homogeneous binary relation on 'G^n.
[Cox_etal]
David A. Cox, John Little, Donal O'Shea,
Ideals, Varieties, and Algorithms,
fourth edition, Springer, 2015.
[MO] https://en.wikipedia.org/wiki/Monomial_order.
This module may be used through the import of
NumAnalysis.Algebra.Monoid.Monoid,
NumAnalysis.Algebra.Algebra,
NumAnalysis.Algebra.Algebra_wDep,
NumAnalysis.LM.LM_wDep, or
NumAnalysis.FEM.FEM_wDep, where it is exported.
Brief description
Description
Elementary monomial properties
- br_plus_compat_l R means that any relation R x1 x2 is kept when "adding on the left" the same value to both arguments.
- br_plus_compat_r R means that any relation R x1 x2 is kept when
"adding on the right" the same value to both arguments.
- br_plus_reg_l R means that any relation R (x + x1) (x + x2) is kept when removing both "x +", ie when "subtracting on the left".
- br_plus_reg_r R means that any relation R (x1 + x) (x2 + x) is kept
when removing both "+ x", ie when "subtracting on the right".
- zero_is_left R means that 0 is comparable on the left to all elements.
- zero_is_right R means that 0 is comparable on the right to all elements.
Compound monomial properties
- monomial_order R means that R is irreflexive, asymmetric, transitive, connected and compatible with plus on the right, ie it is a strict total order compatible with plus.
- monomial_order_zl R means that R is a monomial order for which 0 is comparable on the left to all elements.
- monomial_order_zr R means that R is a monomial order for which 0 is comparable on the right to all elements.
- monomial_order_ns R means that R is reflexive, antisymmetric, transitive, strongly connected and compatible with plus on the right, ie it is a total order compatible with plus.
- "mo" for "monomial_order",
- "mozl" for "monomial_order_zl",
- "mozr" for "monomial_order_zr", and
- "mons" for "monomial_order_ns".
Operator
- graded R Rn compares the sum of the arguments with R, and in case of
equality, use Rn.
- grlex R is graded R (lex R).
- grcolex R is graded R (colex R).
- grsymlex R is graded R (symlex R).
- grevlex R is graded R (revlex R).
Used logic axiom
- classic_dec, an alias for excluded_middle_informative, the strong form of excluded middle (through eq_dec).
Bibliography
Usage
From NumAnalysis Require Import stdlib ssr_wMC.
From Coquelicot Require Import Hierarchy.
Close Scope R_scope.
From NumAnalysis Require Import Subsets_wDep.
From NumAnalysis Require Import Hierarchy_compl.
From NumAnalysis Require Import Monoid_compl Monoid_FF Monoid_sum.
Local Open Scope Monoid_scope.
Section Monomial_order_Def.
Context {G : AbelianMonoid}.
Variable R : G → G → Prop.
Elementary monomial properties.
"br" stands for "binary relation".
Definition br_plus_compat_l : Prop :=
∀ x x1 x2, R x1 x2 → R (x + x1) (x + x2).
Definition br_plus_compat_r : Prop :=
∀ x x1 x2, R x1 x2 → R (x1 + x) (x2 + x).
∀ x x1 x2, R x1 x2 → R (x + x1) (x + x2).
Definition br_plus_compat_r : Prop :=
∀ x x1 x2, R x1 x2 → R (x1 + x) (x2 + x).
"br" stands for "binary relation".
Definition br_plus_reg_l : Prop :=
∀ x x1 x2, R (x + x1) (x + x2) → R x1 x2.
Definition br_plus_reg_r : Prop :=
∀ x x1 x2, R (x1 + x) (x2 + x) → R x1 x2.
Definition zero_is_left : Prop := ∀ x, x ≠ 0 → R 0 x.
Definition zero_is_right : Prop := ∀ x, x ≠ 0 → R x 0.
∀ x x1 x2, R (x + x1) (x + x2) → R x1 x2.
Definition br_plus_reg_r : Prop :=
∀ x x1 x2, R (x1 + x) (x2 + x) → R x1 x2.
Definition zero_is_left : Prop := ∀ x, x ≠ 0 → R 0 x.
Definition zero_is_right : Prop := ∀ x, x ≠ 0 → R x 0.
Compound monomial properties.
"br" stands for "binary relation".
Definition br_monoid_compat_zl : Prop :=
br_plus_compat_r ∧ zero_is_left.
Definition br_monoid_compat_zr : Prop :=
br_plus_compat_r ∧ zero_is_right.
Definition monomial_order : Prop := strict_total_order R ∧ br_plus_compat_r.
Definition monomial_order_zl : Prop :=
strict_total_order R ∧ br_monoid_compat_zl.
Definition monomial_order_zr : Prop :=
strict_total_order R ∧ br_monoid_compat_zr.
br_plus_compat_r ∧ zero_is_left.
Definition br_monoid_compat_zr : Prop :=
br_plus_compat_r ∧ zero_is_right.
Definition monomial_order : Prop := strict_total_order R ∧ br_plus_compat_r.
Definition monomial_order_zl : Prop :=
strict_total_order R ∧ br_monoid_compat_zl.
Definition monomial_order_zr : Prop :=
strict_total_order R ∧ br_monoid_compat_zr.
"ns" stands for "nonstrict".
Definition monomial_order_ns : Prop := total_order R ∧ br_plus_compat_r.
End Monomial_order_Def.
Section Monomial_order_Facts1.
Context {G : AbelianMonoid}.
End Monomial_order_Def.
Section Monomial_order_Facts1.
Context {G : AbelianMonoid}.
Results about monomial properties.
About the br_plus_compat_l / br_plus_compat_r /
br_plus_reg_l / br_plus_reg_r elementary properties.
Lemma br_plus_compat_equiv :
∀ {R : G → G → Prop}, br_plus_compat_l R ↔ br_plus_compat_r R.
Proof.
intro; split; intros H x x1 x2;
[rewrite !(plus_comm _ x) | rewrite !(plus_comm x)]; apply H.
Qed.
Lemma br_plus_compat2_r :
∀ {R : G → G → Prop},
transitive R → br_plus_compat_r R →
∀ a b c d, R a c → R b d → R (a + b) (c + d).
Proof.
intros R HR1 HR2 a b c d Hx Hy; apply HR1 with (c + b); auto.
apply br_plus_compat_equiv in HR2; auto.
Qed.
Lemma br_plus_reg_equiv :
∀ {R : G → G → Prop}, br_plus_reg_l R ↔ br_plus_reg_r R.
Proof.
intro; split; intros H x x1 x2;
[rewrite -!(plus_comm x) | rewrite !(plus_comm x)]; apply H.
Qed.
Lemma br_plus_compat_reg_r :
∀ {R : G → G → Prop},
irreflexive R → asymmetric R → connected R →
br_plus_compat_r R → br_plus_reg_r R.
Proof.
intros R H1 H2 H3 H4 x x1 x2 H5; destruct (eq_dec x1 x2) as [H6 | H6].
exfalso; subst; apply (H1 _ H5).
destruct (H3 _ _ H6) as [H7 | H7]; [easy | exfalso].
apply (H2 (x1 + x) (x2 + x)); [easy | apply (H4 _ _ _ H7)].
Qed.
Lemma br_plus_compat_reg_l :
∀ {R : G → G → Prop},
irreflexive R → asymmetric R → connected R →
br_plus_compat_l R → br_plus_reg_l R.
Proof.
intro; rewrite br_plus_compat_equiv br_plus_reg_equiv;
apply br_plus_compat_reg_r.
Qed.
Lemma br_plus_compat_is_reg_r :
∀ {R : G → G → Prop},
irreflexive R → connected R → br_plus_compat_r R → @plus_is_reg_r G.
Proof.
move=>> H1 /conn_equiv_contra H2 H3 x x1 x2 H4; apply H2; intros H5;
apply (H1 (x1 + x)); [rewrite {2}H4 | rewrite {1}H4]; apply H3; easy.
Qed.
Lemma br_plus_compat_is_reg_l :
∀ {R : G → G → Prop},
irreflexive R → connected R → br_plus_compat_l R → @plus_is_reg_l G.
Proof.
intro; rewrite br_plus_compat_equiv plus_is_reg_equiv.
apply br_plus_compat_is_reg_r.
Qed.
Lemma mo_plus_is_reg_r :
∀ (R : G → G → Prop), monomial_order R → @plus_is_reg_r G.
Proof. move=>> [HR1 /br_plus_compat_is_reg_r HR2]; apply HR2; apply HR1. Qed.
Lemma mo_plus_is_reg_l :
∀ (R : G → G → Prop), monomial_order R → @plus_is_reg_l G.
Proof. move=>> /mo_plus_is_reg_r; apply plus_is_reg_equiv. Qed.
Lemma br_plus_conn :
∀ {R : G → G → Prop},
monomial_order R → ∀ a b c d, a + b = c + d → R a c → R d b.
Proof.
intros R [HR1 HR2].
assert (HG1 : @plus_is_reg_r G) by now apply (mo_plus_is_reg_r R).
generalize HR1; move ⇒ [_ [/irrefl_equiv HR1A _]].
assert (HR1B : trichotomous R) by apply HR1.
intros a b c d H1 H2; destruct (HR1B b d) as [H | [H | H]]; [.. | easy].
exfalso; destruct H as [H _]; subst; apply (HR1A a c); [apply (HG1 d) |]; easy.
exfalso; destruct H as [_ [H _]]; apply (HR1A (a + b) (c + d)); [easy |].
apply br_plus_compat2_r; [apply HR1 | easy..].
Qed.
Lemma br_plus_conn_equiv :
∀ {R : G → G → Prop},
monomial_order R →
∀ a b c d, a + b = c + d → R a c ↔ R d b.
Proof.
intros; split; apply br_plus_conn; [..| rewrite plus_comm (plus_comm b)]; easy.
Qed.
Lemma br_sum_conn_equiv :
∀ {R : G → G → Prop},
monomial_order R →
∀ {n} {i0} {u v : 'G^n.+1},
sum u = sum v →
R (u i0) (v i0) ↔ R (sum (skipF i0 v)) (sum (skipF i0 u)).
Proof.
move=>> HR n i0 u v; rewrite !(sum_skipF i0); apply br_plus_conn_equiv; easy.
Qed.
About the monomial_order / monomial_order_ns compound properties.
Lemma mo_sto :
∀ {R : G → G → Prop}, monomial_order R → strict_total_order R.
Proof. intros R [H _]; easy. Qed.
Lemma mo_irrefl :
∀ {R : G → G → Prop}, monomial_order R → irreflexive R.
Proof. intros R [H _]; apply H. Qed.
Lemma mo_asym : ∀ {R : G → G → Prop}, monomial_order R → asymmetric R.
Proof. intros R [H _]; apply H. Qed.
Lemma mo_trans : ∀ {R : G → G → Prop}, monomial_order R → transitive R.
Proof. intros R [H _]; apply H. Qed.
Lemma mo_conn : ∀ {R : G → G → Prop}, monomial_order R → connected R.
Proof. intros R [H _]; apply H. Qed.
Lemma mo_br_plus_compat_r :
∀ {R : G → G → Prop}, monomial_order R → br_plus_compat_r R.
Proof. intros R [_ H]; easy. Qed.
Lemma mo_br_plus_compat_l :
∀ {R : G → G → Prop}, monomial_order R → br_plus_compat_l R.
Proof. intro; rewrite br_plus_compat_equiv; apply mo_br_plus_compat_r. Qed.
Lemma mo_br_plus_reg_r :
∀ {R : G → G → Prop}, monomial_order R → br_plus_reg_r R.
Proof.
intros R H; apply br_plus_compat_reg_r; move: H;
[apply mo_irrefl | apply mo_asym | apply mo_conn |
apply mo_br_plus_compat_r].
Qed.
Lemma mo_br_plus_reg_l :
∀ {R : G → G → Prop}, monomial_order R → br_plus_reg_l R.
Proof. intro; rewrite br_plus_reg_equiv; apply mo_br_plus_reg_r. Qed.
Lemma mons_to :
∀ {R : G → G → Prop}, monomial_order_ns R → total_order R.
Proof. intros R [H _]; easy. Qed.
Lemma mons_refl :
∀ {R : G → G → Prop}, monomial_order_ns R → reflexive R.
Proof. intros R [H _]; apply H. Qed.
Lemma mons_antisym :
∀ {R : G → G → Prop}, monomial_order_ns R → antisymmetric R.
Proof. intros R [H _]; apply H. Qed.
Lemma mons_trans :
∀ {R : G → G → Prop}, monomial_order_ns R → transitive R.
Proof. intros R [H _]; apply H. Qed.
Lemma mons_str_conn :
∀ {R : G → G → Prop}, monomial_order_ns R → strongly_connected R.
Proof. intros R [H _]; apply H. Qed.
Lemma mons_br_plus_compat_r :
∀ {R : G → G → Prop}, monomial_order_ns R → br_plus_compat_r R.
Proof. intros R [_ H]; easy. Qed.
Lemma mons_br_plus_compat_l :
∀ {R : G → G → Prop}, monomial_order_ns R → br_plus_compat_l R.
Proof. intro; rewrite br_plus_compat_equiv; apply mons_br_plus_compat_r. Qed.
Nonstrict monomial orders are reflexive, thus they cannot satisfy
regularity properties br_plus_reg_l / br_plus_reg_r since those need
irreflexivity, which is incompatible with reflexivity.
In the same way, nonstrict monomial orders do not imply regularity of plus
(ie plus_is_reg_l / plus_is_reg_r hold in the ambient abelian monoid).
Compatibility results of monomial properties with operators.
With the converse operator.
Lemma br_plus_compat_l_conv :
∀ {R : G → G → Prop},
br_plus_compat_l R → br_plus_compat_l (converse R).
Proof. intros R H x x1 x2; apply (H x x2 x1). Qed.
Lemma br_plus_compat_l_conv_equiv :
∀ {R : G → G → Prop},
br_plus_compat_l (converse R) ↔ br_plus_compat_l R.
Proof.
intros R; split; [rewrite -{2}(conv_invol R) |]; apply br_plus_compat_l_conv.
Qed.
Lemma br_plus_compat_r_conv :
∀ {R : G → G → Prop},
br_plus_compat_r R → br_plus_compat_r (converse R).
Proof. intros R H x x1 x2; apply (H x x2 x1). Qed.
Lemma br_plus_compat_r_conv_equiv :
∀ {R : G → G → Prop},
br_plus_compat_r (converse R) ↔ br_plus_compat_r R.
Proof.
intros R; split; [rewrite -{2}(conv_invol R) |]; apply br_plus_compat_r_conv.
Qed.
Lemma br_plus_reg_l_conv :
∀ {R : G → G → Prop}, br_plus_reg_l R → br_plus_reg_l (converse R).
Proof. intros R H x x1 x2; apply (H x x2 x1). Qed.
Lemma br_plus_reg_l_conv_equiv :
∀ {R : G → G → Prop}, br_plus_reg_l (converse R) ↔ br_plus_reg_l R.
Proof.
intros R; split; [rewrite -{2}(conv_invol R) |]; apply br_plus_reg_l_conv.
Qed.
Lemma br_plus_reg_r_conv :
∀ {R : G → G → Prop}, br_plus_reg_r R → br_plus_reg_r (converse R).
Proof. intros R H x x1 x2; apply (H x x2 x1). Qed.
Lemma br_plus_reg_r_conv_equiv :
∀ {R : G → G → Prop}, br_plus_reg_r (converse R) ↔ br_plus_reg_r R.
Proof.
intros R; split; [rewrite -{2}(conv_invol R) |]; apply br_plus_reg_r_conv.
Qed.
Lemma zero_is_left_conv :
∀ {R : G → G → Prop}, zero_is_right R → zero_is_left (converse R).
Proof. intros R H x; apply H. Qed.
Lemma zero_is_right_conv :
∀ {R : G → G → Prop}, zero_is_left R → zero_is_right (converse R).
Proof. intros R H x; apply H. Qed.
Lemma zero_is_left_conv_equiv :
∀ {R : G → G → Prop}, zero_is_left (converse R) ↔ zero_is_right R.
Proof.
intros R; split; [rewrite -{2}(conv_invol R) |];
[apply zero_is_right_conv | apply zero_is_left_conv].
Qed.
Lemma zero_is_right_conv_equiv :
∀ {R : G → G → Prop}, zero_is_right (converse R) ↔ zero_is_left R.
Proof. intro; rewrite zero_is_left_conv_equiv; easy. Qed.
Lemma br_monoid_compat_zl_conv :
∀ {R : G → G → Prop},
br_monoid_compat_zr R → br_monoid_compat_zl (converse R).
Proof.
intro; apply modus_ponens_and;
[apply br_plus_compat_r_conv | apply zero_is_left_conv].
Qed.
Lemma br_monoid_compat_zr_conv :
∀ {R : G → G → Prop},
br_monoid_compat_zl R → br_monoid_compat_zr (converse R).
Proof.
intro; apply modus_ponens_and;
[apply br_plus_compat_r_conv | apply zero_is_right_conv].
Qed.
Lemma br_monoid_compat_zl_conv_equiv :
∀ {R : G → G → Prop},
br_monoid_compat_zl (converse R) ↔ br_monoid_compat_zr R.
Proof.
intros R; split; [rewrite -{2}(conv_invol R) |];
[apply br_monoid_compat_zr_conv | apply br_monoid_compat_zl_conv].
Qed.
Lemma br_monoid_compat_zr_conv_equiv :
∀ {R : G → G → Prop},
br_monoid_compat_zr (converse R) ↔ br_monoid_compat_zl R.
Proof. intro; rewrite br_monoid_compat_zl_conv_equiv; easy. Qed.
Lemma mo_conv :
∀ {R : G → G → Prop}, monomial_order R → monomial_order (converse R).
Proof.
intro; apply modus_ponens_and;
[apply conv_sto | apply br_plus_compat_r_conv].
Qed.
Lemma mo_conv_equiv :
∀ {R : G → G → Prop},
monomial_order (converse R) ↔ monomial_order R.
Proof.
intros R; split; [rewrite -{2}(conv_invol R) |]; apply mo_conv.
Qed.
Lemma mozl_conv :
∀ {R : G → G → Prop},
monomial_order_zr R → monomial_order_zl (converse R).
Proof.
intro; apply modus_ponens_and;
[apply conv_sto | apply br_monoid_compat_zl_conv].
Qed.
Lemma mozr_conv :
∀ {R : G → G → Prop},
monomial_order_zl R → monomial_order_zr (converse R).
Proof.
intro; apply modus_ponens_and;
[apply conv_sto | apply br_monoid_compat_zr_conv].
Qed.
Lemma mozl_conv_equiv :
∀ {R : G → G → Prop},
monomial_order_zl (converse R) ↔ monomial_order_zr R.
Proof.
intros R; split; [rewrite -{2}(conv_invol R) |];
[apply mozr_conv | apply mozl_conv].
Qed.
Lemma mozr_conv_equiv :
∀ {R : G → G → Prop},
monomial_order_zr (converse R) ↔ monomial_order_zl R.
Proof. intro; rewrite mozl_conv_equiv; easy. Qed.
Lemma mons_conv :
∀ {R : G → G → Prop},
monomial_order_ns R → monomial_order_ns (converse R).
Proof.
intro; apply modus_ponens_and;
[apply conv_to; easy | apply br_plus_compat_r_conv].
Qed.
Lemma mons_conv_equiv :
∀ {R : G → G → Prop},
monomial_order_ns (converse R) ↔ monomial_order_ns R.
Proof. intros R; split; [rewrite -{2}(conv_invol R) |]; apply mons_conv. Qed.
With the complementary operator.
Lemma br_plus_compat_l_compl :
∀ {R : G → G → Prop},
br_plus_reg_l R → br_plus_compat_l (complementary R).
Proof. intros R H x x1 x2; rewrite -contra_equiv; apply H. Qed.
Lemma br_plus_compat_r_compl :
∀ {R : G → G → Prop},
br_plus_reg_r R → br_plus_compat_r (complementary R).
Proof. intros R H x x1 x2; rewrite -contra_equiv; apply H. Qed.
Lemma br_plus_reg_l_compl :
∀ {R : G → G → Prop},
br_plus_compat_l R → br_plus_reg_l (complementary R).
Proof. intros R H x x1 x2; rewrite -contra_equiv; apply H. Qed.
Lemma br_plus_reg_r_compl :
∀ {R : G → G → Prop},
br_plus_compat_r R → br_plus_reg_r (complementary R).
Proof. intros R H x x1 x2; rewrite -contra_equiv; apply H. Qed.
Lemma br_plus_compat_l_compl_equiv :
∀ {R : G → G → Prop},
br_plus_compat_l (complementary R) ↔ br_plus_reg_l R.
Proof.
intros R; split; [rewrite -{2}(br_compl_invol R) |];
[apply br_plus_reg_l_compl | apply br_plus_compat_l_compl].
Qed.
Lemma br_plus_compat_r_compl_equiv :
∀ {R : G → G → Prop},
br_plus_compat_r (complementary R) ↔ br_plus_reg_r R.
Proof.
intros R; split; [rewrite -{2}(br_compl_invol R) |];
[apply br_plus_reg_r_compl | apply br_plus_compat_r_compl].
Qed.
Lemma br_plus_reg_l_compl_equiv :
∀ {R : G → G → Prop},
br_plus_reg_l (complementary R) ↔ br_plus_compat_l R.
Proof.
intros R; rewrite -{2}(br_compl_invol R) br_plus_compat_l_compl_equiv; easy.
Qed.
Lemma br_plus_reg_r_compl_equiv :
∀ {R : G → G → Prop},
br_plus_reg_r (complementary R) ↔ br_plus_compat_r R.
Proof.
intros R; rewrite -{2}(br_compl_invol R) br_plus_compat_r_compl_equiv; easy.
Qed.
Properties zero_is_left / zero_is_right / br_monoid_compat_zl /
br_monoid_compat_zr / monomial_order_zl / monomial_order_zl are not
compatible with the operator complementary.
Lemma mo_compl :
∀ {R : G → G → Prop},
total_order R → br_plus_reg_r R → monomial_order (complementary R).
Proof.
intros; split; [apply compl_sto | apply br_plus_compat_r_compl]; easy.
Qed.
Lemma mo_compl_equiv :
∀ {R : G → G → Prop},
monomial_order (complementary R) ↔ total_order R ∧ br_plus_reg_r R.
Proof.
intros; apply and_iff_compat; [apply compl_sto_equiv; easy |
apply br_plus_compat_r_compl_equiv].
Qed.
Lemma mons_compl :
∀ {R : G → G → Prop},
strict_total_order R → br_plus_reg_r R →
monomial_order_ns (complementary R).
Proof.
intros; split; [apply compl_to | apply br_plus_compat_r_compl]; easy.
Qed.
Lemma mons_compl_equiv :
∀ {R : G → G → Prop},
monomial_order_ns (complementary R) ↔
strict_total_order R ∧ br_plus_reg_r R.
Proof.
intros; apply and_iff_compat; [apply compl_to_equiv; easy |
apply br_plus_compat_r_compl_equiv].
Qed.
With the conv_compl operator.
Lemma br_plus_compat_l_conv_compl :
∀ {R : G → G → Prop},
br_plus_reg_l R → br_plus_compat_l (conv_compl R).
Proof. intros; apply br_plus_compat_l_conv, br_plus_compat_l_compl; easy. Qed.
Lemma br_plus_compat_r_conv_compl :
∀ {R : G → G → Prop},
br_plus_reg_r R → br_plus_compat_r (conv_compl R).
Proof. intros; apply br_plus_compat_r_conv, br_plus_compat_r_compl; easy. Qed.
Lemma br_plus_reg_l_conv_compl :
∀ {R : G → G → Prop},
br_plus_compat_l R → br_plus_reg_l (conv_compl R).
Proof. intros; apply br_plus_reg_l_conv, br_plus_reg_l_compl; easy. Qed.
Lemma br_plus_reg_r_conv_compl :
∀ {R : G → G → Prop},
br_plus_compat_r R → br_plus_reg_r (conv_compl R).
Proof. intros; apply br_plus_reg_r_conv, br_plus_reg_r_compl; easy. Qed.
Lemma br_plus_compat_l_conv_compl_equiv :
∀ {R : G → G → Prop},
br_plus_compat_l (conv_compl R) ↔ br_plus_reg_l R.
Proof.
intros; rewrite br_plus_compat_l_conv_equiv br_plus_compat_l_compl_equiv; easy.
Qed.
Lemma br_plus_compat_r_conv_compl_equiv :
∀ {R : G → G → Prop},
br_plus_compat_r (conv_compl R) ↔ br_plus_reg_r R.
Proof.
intros; rewrite br_plus_compat_r_conv_equiv br_plus_compat_r_compl_equiv; easy.
Qed.
Lemma br_plus_reg_l_conv_compl_equiv :
∀ {R : G → G → Prop},
br_plus_reg_l (conv_compl R) ↔ br_plus_compat_l R.
Proof.
intros; rewrite br_plus_reg_l_conv_equiv br_plus_reg_l_compl_equiv; easy.
Qed.
Lemma br_plus_reg_r_conv_compl_equiv :
∀ {R : G → G → Prop},
br_plus_reg_r (conv_compl R) ↔ br_plus_compat_r R.
Proof.
intros; rewrite br_plus_reg_r_conv_equiv br_plus_reg_r_compl_equiv; easy.
Qed.
Properties zero_is_left / zero_is_right / br_monoid_compat_zl /
br_monoid_compat_zr / monomial_order_zl / monomial_order_zl are not
compatible with the operator conv_compl.
Lemma mo_conv_compl :
∀ {R : G → G → Prop},
total_order R → br_plus_reg_r R → monomial_order (conv_compl R).
Proof. intros; apply mo_conv, mo_compl; easy. Qed.
Lemma mo_conv_compl_equiv :
∀ {R : G → G → Prop},
monomial_order (conv_compl R) ↔ total_order R ∧ br_plus_reg_r R.
Proof. intros; rewrite mo_conv_equiv mo_compl_equiv; easy. Qed.
Lemma mons_conv_compl :
∀ {R : G → G → Prop},
strict_total_order R → br_plus_reg_r R →
monomial_order_ns (conv_compl R).
Proof. intros; apply mons_conv, mons_compl; easy. Qed.
Lemma mons_conv_compl_equiv :
∀ {R : G → G → Prop},
monomial_order_ns (conv_compl R) ↔
strict_total_order R ∧ br_plus_reg_r R.
Proof. intro; rewrite mons_conv_equiv mons_compl_equiv; easy. Qed.
End Monomial_order_Facts2.
Section Monomial_order_nat_Facts.
Lemma lt_plus_compat_l : br_plus_compat_l lt.
Proof. move=>>; apply Nat.add_lt_mono_l. Qed.
Lemma lt_plus_compat_r : br_plus_compat_r lt.
Proof. move=>>; apply Nat.add_lt_mono_r. Qed.
Lemma lt_plus_reg_l : br_plus_reg_l lt.
Proof. move=>>; apply Nat.add_lt_mono_l. Qed.
Lemma lt_plus_reg_r : br_plus_reg_r lt.
Proof. move=>>; apply Nat.add_lt_mono_r. Qed.
Lemma lt_zero_is_left : zero_is_left lt.
Proof. intro; apply Nat.neq_0_lt_0. Qed.
Lemma lt_monoid_compat_zl : br_monoid_compat_zl lt.
Proof. split; [apply lt_plus_compat_r | apply lt_zero_is_left]. Qed.
Lemma lt_mo : monomial_order lt.
Proof. split; [apply lt_sto | apply lt_plus_compat_r]. Qed.
Lemma lt_mozl : monomial_order_zl lt.
Proof. split; [apply lt_sto | apply lt_monoid_compat_zl]. Qed.
Lemma le_plus_compat_l : br_plus_compat_l le.
Proof. move=>>; apply Nat.add_le_mono_l. Qed.
Lemma le_plus_compat_r : br_plus_compat_r le.
Proof. move=>>; apply Nat.add_le_mono_r. Qed.
Lemma le_plus_reg_l : br_plus_reg_l le.
Proof. move=>>; apply Nat.add_le_mono_l. Qed.
Lemma le_plus_reg_r : br_plus_reg_r le.
Proof. move=>>; apply Nat.add_le_mono_r. Qed.
Lemma le_zero_is_left : zero_is_left le.
Proof. intros x _; apply Nat.le_0_l. Qed.
Lemma le_monoid_compat_zl : br_monoid_compat_zl le.
Proof. split; [apply le_plus_compat_r | apply le_zero_is_left]. Qed.
Lemma le_mons : monomial_order_ns le.
Proof. split; [apply le_to | apply le_plus_compat_r]. Qed.
End Monomial_order_nat_Facts.
Section Lex_order_Facts.
Compatibility results of the *lex operators with monomial properties.
With the br_plus_compat_r / br_plus_compat_l elementary properties.
Lemma rev_br_plus_compat_r :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
br_plus_compat_r Rn → br_plus_compat_r (reverse Rn).
Proof. move=>> HRn x x1 x2; apply HRn. Qed.
Lemma lex_br_plus_compat_r :
∀ {R : G → G → Prop},
br_plus_compat_r R → ∀ {n}, br_plus_compat_r (@lex _ R n).
Proof.
intros R H1 n x x1 x2; induction n; [easy |].
rewrite !lex_S; rewrite !fct_plus_eq; intros [[H2 H3] | [H2 H3]].
left; split; [contradict H2; apply HG1 with (x ord0) | apply H1]; easy.
right; split; [apply plus_compat_r | apply IHn]; easy.
Qed.
Lemma colex_br_plus_compat_r :
∀ {R : G → G → Prop},
br_plus_compat_r R → ∀ {n}, br_plus_compat_r (@colex _ R n).
Proof. intros; apply rev_br_plus_compat_r, lex_br_plus_compat_r; easy. Qed.
Lemma symlex_br_plus_compat_r :
∀ {R : G → G → Prop},
br_plus_compat_r R → ∀ {n}, br_plus_compat_r (@symlex _ R n).
Proof. intros; apply br_plus_compat_r_conv, lex_br_plus_compat_r; easy. Qed.
Lemma revlex_br_plus_compat_r :
∀ {R : G → G → Prop},
br_plus_compat_r R → ∀ {n}, br_plus_compat_r (@revlex _ R n).
Proof. intros; apply br_plus_compat_r_conv, colex_br_plus_compat_r; easy. Qed.
Lemma rev_br_plus_compat_l :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
br_plus_compat_l Rn → br_plus_compat_l (reverse Rn).
Proof. move=>> HRn x x1 x2; apply HRn. Qed.
Lemma lex_br_plus_compat_l :
∀ {R : G → G → Prop},
br_plus_compat_l R → ∀ {n}, br_plus_compat_l (@lex _ R n).
Proof.
intros R H1 n; move: H1; rewrite !br_plus_compat_equiv; intros H1.
apply lex_br_plus_compat_r; easy.
Qed.
Lemma colex_br_plus_compat_l :
∀ {R : G → G → Prop},
br_plus_compat_l R → ∀ {n}, br_plus_compat_l (@colex _ R n).
Proof. intros; apply rev_br_plus_compat_l, lex_br_plus_compat_l; easy. Qed.
Lemma symlex_br_plus_compat_l :
∀ {R : G → G → Prop},
br_plus_compat_l R → ∀ {n}, br_plus_compat_l (@symlex _ R n).
Proof. intros; apply br_plus_compat_l_conv, lex_br_plus_compat_l; easy. Qed.
Lemma revlex_br_plus_compat_l :
∀ {R : G → G → Prop},
br_plus_compat_l R → ∀ {n}, br_plus_compat_l (@revlex _ R n).
Proof. intros; apply br_plus_compat_l_conv, colex_br_plus_compat_l; easy. Qed.
With the br_plus_reg_r / br_plus_reg_l elementary properties.
Lemma rev_br_plus_reg_r :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
br_plus_reg_r Rn → br_plus_reg_r (reverse Rn).
Proof. move=>> HRn x x1 x2; apply HRn. Qed.
Lemma lex_br_plus_reg_r :
∀ {R : G → G → Prop},
br_plus_reg_r R → ∀ {n}, br_plus_reg_r (@lex _ R n).
Proof.
intros R H1 n x x1 x2; induction n; [easy |].
rewrite !lex_S; rewrite !fct_plus_eq; intros [[H2 H3] | [H2 H3]].
left; split;
[contradict H2; apply plus_compat_r | apply H1 with (x ord0)]; easy.
right; split;
[apply HG1 with (x ord0) | apply IHn with (skipF0 x)]; easy.
Qed.
Lemma colex_br_plus_reg_r :
∀ {R : G → G → Prop},
br_plus_reg_r R → ∀ {n}, br_plus_reg_r (@colex _ R n).
Proof. intros; apply rev_br_plus_reg_r, lex_br_plus_reg_r; easy. Qed.
Lemma symlex_br_plus_reg_r :
∀ {R : G → G → Prop},
br_plus_reg_r R → ∀ {n}, br_plus_reg_r (@symlex _ R n).
Proof. intros; apply br_plus_reg_r_conv, lex_br_plus_reg_r; easy. Qed.
Lemma revlex_br_plus_reg_r :
∀ {R : G → G → Prop},
br_plus_reg_r R → ∀ {n}, br_plus_reg_r (@revlex _ R n).
Proof. intros; apply br_plus_reg_r_conv, colex_br_plus_reg_r; easy. Qed.
Lemma rev_br_plus_reg_l :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
br_plus_reg_l Rn → br_plus_reg_l (reverse Rn).
Proof. move=>> HRn x x1 x2; apply HRn. Qed.
Lemma lex_br_plus_reg_l :
∀ {R : G → G → Prop},
br_plus_reg_l R → ∀ {n}, br_plus_reg_l (@lex _ R n).
Proof.
intros R H1 n; move: H1; rewrite !br_plus_reg_equiv; intros H1.
apply lex_br_plus_reg_r; easy.
Qed.
Lemma colex_br_plus_reg_l :
∀ {R : G → G → Prop},
br_plus_reg_l R → ∀ {n}, br_plus_reg_l (@colex _ R n).
Proof. intros; apply rev_br_plus_reg_l, lex_br_plus_reg_l; easy. Qed.
Lemma symlex_br_plus_reg_l :
∀ {R : G → G → Prop},
br_plus_reg_l R → ∀ {n}, br_plus_reg_l (@symlex _ R n).
Proof. intros; apply br_plus_reg_l_conv, lex_br_plus_reg_l; easy. Qed.
Lemma revlex_br_plus_reg_l :
∀ {R : G → G → Prop},
br_plus_reg_l R → ∀ {n}, br_plus_reg_l (@revlex _ R n).
Proof. intros; apply br_plus_reg_l_conv, colex_br_plus_reg_l; easy. Qed.
With the zero_is_left / zero_is_right elementary properties.
Lemma rev_zero_is_left :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
zero_is_left Rn → zero_is_left (reverse Rn).
Proof.
move=>> HRn x H; apply HRn; contradict H; apply revF_zero_reg; easy.
Qed.
Lemma lex_zero_is_left :
∀ {R : G → G → Prop},
zero_is_left R → ∀ {n}, zero_is_left (@lex _ R n).
Proof.
intros R H n x Hx; induction n; [contradict Hx; apply hat0F_unit; easy |].
rewrite lex_S; destruct (eq_dec 0 (x ord0)) as [Hx0 | Hx0].
rewrite -Hx0; right; split; [easy |].
apply IHn; contradict Hx; apply extF_skipF with ord0; easy.
left; split; [| apply H, neq_sym_equiv]; easy.
Qed.
Lemma colex_zero_is_left :
∀ {R : G → G → Prop},
zero_is_left R → ∀ {n}, zero_is_left (@colex _ R n).
Proof. intros; apply rev_zero_is_left, lex_zero_is_left; easy. Qed.
Lemma symlex_zero_is_right :
∀ {R : G → G → Prop},
zero_is_left R → ∀ {n}, zero_is_right (@symlex _ R n).
Proof. intros; apply zero_is_right_conv, lex_zero_is_left; easy. Qed.
Lemma revlex_zero_is_right :
∀ {R : G → G → Prop},
zero_is_left R → ∀ {n}, zero_is_right (@revlex _ R n).
Proof. intros; apply zero_is_right_conv, colex_zero_is_left; easy. Qed.
Lemma rev_zero_is_right :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
zero_is_right Rn → zero_is_right (reverse Rn).
Proof.
move=>> HRn x H; apply HRn; contradict H; apply revF_zero_reg; easy.
Qed.
Lemma lex_zero_is_right :
∀ {R : G → G → Prop},
zero_is_right R → ∀ {n}, zero_is_right (@lex _ R n).
Proof.
intros R H n x Hx; induction n; [contradict Hx; apply hat0F_unit; easy |].
rewrite lex_S; destruct (eq_dec (x ord0) 0) as [Hx0 | Hx0].
rewrite Hx0; right; split; [easy |].
apply IHn; contradict Hx; apply extF_skipF with ord0; easy.
left; split; [| apply H]; easy.
Qed.
Lemma colex_zero_is_right :
∀ {R : G → G → Prop},
zero_is_right R → ∀ {n}, zero_is_right (@colex _ R n).
Proof. intros; apply rev_zero_is_right, lex_zero_is_right; easy. Qed.
Lemma symlex_zero_is_left :
∀ {R : G → G → Prop},
zero_is_right R → ∀ {n}, zero_is_left (@symlex _ R n).
Proof. intros; apply zero_is_left_conv, lex_zero_is_right; easy. Qed.
Lemma revlex_zero_is_left :
∀ {R : G → G → Prop},
zero_is_right R → ∀ {n}, zero_is_left (@revlex _ R n).
Proof. intros; apply zero_is_left_conv, colex_zero_is_right; easy. Qed.
With the br_monoid_compat_zl / br_monoid_compat_zr compound properties.
Lemma rev_br_monoid_compat_zl :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
br_monoid_compat_zl Rn → br_monoid_compat_zl (reverse Rn).
Proof.
move=>>; apply modus_ponens_and;
[apply rev_br_plus_compat_r | apply rev_zero_is_left].
Qed.
Lemma lex_br_monoid_compat_zl :
∀ {R : G → G → Prop},
br_monoid_compat_zl R → ∀ {n}, br_monoid_compat_zl (@lex _ R n).
Proof.
intros R H1 n; move: H1; apply modus_ponens_and; intros H1;
[apply lex_br_plus_compat_r | apply lex_zero_is_left]; easy.
Qed.
Lemma colex_br_monoid_compat_zl :
∀ {R : G → G → Prop},
br_monoid_compat_zl R → ∀ {n}, br_monoid_compat_zl (@colex _ R n).
Proof.
intros; apply rev_br_monoid_compat_zl, lex_br_monoid_compat_zl; easy.
Qed.
Lemma symlex_br_monoid_compat_zr :
∀ {R : G → G → Prop},
br_monoid_compat_zl R → ∀ {n}, br_monoid_compat_zr (@symlex _ R n).
Proof.
intros; apply br_monoid_compat_zr_conv, lex_br_monoid_compat_zl; easy.
Qed.
Lemma revlex_br_monoid_compat_zr :
∀ {R : G → G → Prop},
br_monoid_compat_zl R → ∀ {n}, br_monoid_compat_zr (@revlex _ R n).
Proof.
intros; apply br_monoid_compat_zr_conv, colex_br_monoid_compat_zl; easy.
Qed.
Lemma rev_br_monoid_compat_zr :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
br_monoid_compat_zr Rn → br_monoid_compat_zr (reverse Rn).
Proof.
move=>>; apply modus_ponens_and;
[apply rev_br_plus_compat_r | apply rev_zero_is_right].
Qed.
Lemma lex_br_monoid_compat_zr :
∀ {R : G → G → Prop},
br_monoid_compat_zr R → ∀ {n}, br_monoid_compat_zr (@lex _ R n).
Proof.
intros R H1 n; move: H1; apply modus_ponens_and; intros H1;
[apply lex_br_plus_compat_r | apply lex_zero_is_right]; easy.
Qed.
Lemma colex_br_monoid_compat_zr :
∀ {R : G → G → Prop},
br_monoid_compat_zr R → ∀ {n}, br_monoid_compat_zr (@colex _ R n).
Proof.
intros; apply rev_br_monoid_compat_zr, lex_br_monoid_compat_zr; easy.
Qed.
Lemma symlex_br_monoid_compat_zl :
∀ {R : G → G → Prop},
br_monoid_compat_zr R → ∀ {n}, br_monoid_compat_zl (@symlex _ R n).
Proof.
intros; apply br_monoid_compat_zl_conv, lex_br_monoid_compat_zr; easy.
Qed.
Lemma revlex_br_monoid_compat_zl :
∀ {R : G → G → Prop},
br_monoid_compat_zr R → ∀ {n}, br_monoid_compat_zl (@revlex _ R n).
Proof.
intros; apply br_monoid_compat_zl_conv, colex_br_monoid_compat_zr; easy.
Qed.
With the monomial_order / monomial_order_zl / monomial_order_zr /
monomial_order_ns compound properties.
Lemma rev_mo :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
monomial_order Rn → monomial_order (reverse Rn).
Proof.
move=>>; apply modus_ponens_and; [apply rev_sto | apply rev_br_plus_compat_r].
Qed.
Lemma lex_mo :
∀ {R : G → G → Prop},
monomial_order R → ∀ {n}, monomial_order (@lex _ R n).
Proof.
intros R H1 n; move: H1; apply modus_ponens_and; intros H1;
[apply lex_sto | apply lex_br_plus_compat_r]; easy.
Qed.
Lemma colex_mo :
∀ {R : G → G → Prop},
monomial_order R → ∀ {n}, monomial_order (@colex _ R n).
Proof. intros; apply rev_mo, lex_mo; easy. Qed.
Lemma symlex_mo :
∀ {R : G → G → Prop},
monomial_order R → ∀ {n}, monomial_order (@symlex _ R n).
Proof. intros; apply mo_conv, lex_mo; easy. Qed.
Lemma revlex_mo :
∀ {R : G → G → Prop},
monomial_order R → ∀ {n}, monomial_order (@revlex _ R n).
Proof. intros; apply mo_conv, colex_mo; easy. Qed.
Lemma rev_mozl :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
monomial_order_zl Rn → monomial_order_zl (reverse Rn).
Proof.
move=>>; apply modus_ponens_and;
[apply rev_sto | apply rev_br_monoid_compat_zl].
Qed.
Lemma lex_mozl :
∀ {R : G → G → Prop},
monomial_order_zl R → ∀ {n}, monomial_order_zl (@lex _ R n).
Proof.
intros R H1 n; move: H1; apply modus_ponens_and; intros H1;
[apply lex_sto | apply lex_br_monoid_compat_zl]; easy.
Qed.
Lemma colex_mozl :
∀ {R : G → G → Prop},
monomial_order_zl R → ∀ {n}, monomial_order_zl (@colex _ R n).
Proof. intros; apply rev_mozl, lex_mozl; easy. Qed.
Lemma symlex_mozr :
∀ {R : G → G → Prop},
monomial_order_zl R → ∀ {n}, monomial_order_zr (@symlex _ R n).
Proof. intros; apply mozr_conv, lex_mozl; easy. Qed.
Lemma revlex_mozr :
∀ {R : G → G → Prop},
monomial_order_zl R → ∀ {n}, monomial_order_zr (@revlex _ R n).
Proof. intros; apply mozr_conv, colex_mozl; easy. Qed.
Lemma rev_mozr :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
monomial_order_zr Rn → monomial_order_zr (reverse Rn).
Proof.
move=>>; apply modus_ponens_and;
[apply rev_sto | apply rev_br_monoid_compat_zr].
Qed.
Lemma lex_mozr :
∀ {R : G → G → Prop},
monomial_order_zr R → ∀ {n}, monomial_order_zr (@lex _ R n).
Proof.
intros R H n; move: H; apply modus_ponens_and; intros H;
[apply lex_sto | apply lex_br_monoid_compat_zr]; easy.
Qed.
Lemma colex_mozr :
∀ {R : G → G → Prop},
monomial_order_zr R → ∀ {n}, monomial_order_zr (@colex _ R n).
Proof. intros; apply rev_mozr, lex_mozr; easy. Qed.
Lemma symlex_mozl :
∀ {R : G → G → Prop},
monomial_order_zr R → ∀ {n}, monomial_order_zl (@symlex _ R n).
Proof. intros; apply mozl_conv, lex_mozr; easy. Qed.
Lemma revlex_mozl :
∀ {R : G → G → Prop},
monomial_order_zr R → ∀ {n}, monomial_order_zl (@revlex _ R n).
Proof. intros; apply mozl_conv, colex_mozr; easy. Qed.
Lemma rev_mons :
∀ {n} {Rn : 'G^n → 'G^n → Prop},
monomial_order_ns Rn → monomial_order_ns (reverse Rn).
Proof.
move=>>; apply modus_ponens_and; [apply rev_to | apply rev_br_plus_compat_r].
Qed.
Lemma lex_mons :
∀ {R : G → G → Prop},
monomial_order_ns R → ∀ {n}, monomial_order_ns (@lex _ R n).
Proof.
intros R H n; move: H; apply modus_ponens_and; intros H;
[apply lex_to | apply lex_br_plus_compat_r]; easy.
Qed.
Lemma colex_mons :
∀ {R : G → G → Prop},
monomial_order_ns R → ∀ {n}, monomial_order_ns (@colex _ R n).
Proof. intros; apply rev_mons, lex_mons; easy. Qed.
Lemma symlex_mons :
∀ {R : G → G → Prop},
monomial_order_ns R → ∀ {n}, monomial_order_ns (@symlex _ R n).
Proof. intros; apply mons_conv, lex_mons; easy. Qed.
Lemma revlex_mons :
∀ {R : G → G → Prop},
monomial_order_ns R → ∀ {n}, monomial_order_ns (@revlex _ R n).
Proof. intros; apply mons_conv, colex_mons; easy. Qed.
Lemma lex_sortedF_itemF :
∀ {R : G → G → Prop}, transitive R → antisymmetric R →
∀ {n} g, g ≠ 0 → R g 0 → sortedF (lex R) (fun i ⇒ itemF n i g).
Proof.
intros R HR1 HR2 n g Hg1 Hg2; induction n as [| n IHn]; [apply sortedF_nil |].
apply sortedF_equiv; [apply lex_trans; easy |].
intros i Hi1; case (ord_eq_dec i ord0); intros Hi2; rewrite lex_S.
left; rewrite itemF_correct_l// itemF_correct_r; easy.
right; split; [rewrite !itemF_correct_r; easy |].
rewrite 2!skipF_itemF_0//; intros Hi3; apply IHn.
rewrite 2!lower_S_correct; simpl; apply Nat.lt_pred_l.
contradict Hi2; apply ord_inj; easy.
Qed.
Lemma symlex_sortedF_itemF :
∀ {R : G → G → Prop}, transitive R → antisymmetric R →
∀ {n} g, g ≠ 0 → R 0 g → sortedF (symlex R) (fun i ⇒ itemF n i g).
Proof.
intros; unfold symlex; rewrite -lex_conv; apply lex_sortedF_itemF;
[apply conv_trans | apply conv_antisym |..]; easy.
Qed.
End Lex_order_Facts.
Section Graded_monomial_order_Def.
Graded monomial orders.
Context {G : AbelianMonoid}.
Variable R : G → G → Prop.
Context {n : nat}.
Definition graded (Rn : 'G^n → 'G^n → Prop) (x y : 'G^n) : Prop :=
sum x ≠ sum y ∧ R (sum x) (sum y) ∨ sum x = sum y ∧ Rn x y.
End Graded_monomial_order_Def.
Section Graded_monomial_order_Facts1.
General properties of graded monomial orders.
Context {G : AbelianMonoid}.
Hypothesis HG1 : @plus_is_reg_r G.
Lemma graded_l :
∀ R {n} (Rn : 'G^n → 'G^n → Prop) x y,
sum x ≠ sum y → R (sum x) (sum y) → graded R Rn x y.
Proof. intros; left; easy. Qed.
Lemma graded_l_rev :
∀ R {n} (Rn : 'G^n → 'G^n → Prop) x y,
sum x ≠ sum y → graded R Rn x y → R (sum x) (sum y).
Proof. move=>> H1 [H2 | H2]; easy. Qed.
Lemma graded_l_equiv :
∀ R {n} (Rn : 'G^n → 'G^n → Prop) x y,
sum x ≠ sum y → graded R Rn x y ↔ R (sum x) (sum y).
Proof. intros; split; [apply graded_l_rev | apply graded_l]; easy. Qed.
Lemma graded_r :
∀ R {n} (Rn : 'G^n → 'G^n → Prop) x y,
sum x = sum y → Rn x y → graded R Rn x y.
Proof. intros; right; easy. Qed.
Lemma graded_r_rev :
∀ R {n} (Rn : 'G^n → 'G^n → Prop) x y,
sum x = sum y → graded R Rn x y → Rn x y.
Proof. move=>> H1 [H2 | H2]; easy. Qed.
Lemma graded_r_equiv :
∀ R {n} (Rn : 'G^n → 'G^n → Prop) x y,
sum x = sum y → graded R Rn x y ↔ Rn x y.
Proof. intros; split; [apply graded_r_rev | apply graded_r]; easy. Qed.
Lemma graded_S_r_equiv :
∀ R {n} (Rn : 'G^n → 'G^n → Prop) i0 (x y : 'G^n.+1),
x i0 = y i0 → sum x = sum y →
graded R Rn (skipF i0 x) (skipF i0 y) ↔ Rn (skipF i0 x) (skipF i0 y).
Proof. intros; apply graded_r_equiv, sum_skipF_equiv; easy. Qed.
Lemma graded_diag :
∀ R {n} (Rn : 'G^n → 'G^n → Prop) x, graded R Rn x x ↔ Rn x x.
Proof. intros; split; [intros [H | H] | apply graded_r]; easy. Qed.
Lemma graded_idem :
∀ {R1} R2 {n} {Rn : 'G^n → 'G^n → Prop},
graded R1 (graded R2 Rn) = graded R1 Rn.
Proof.
intros; fun_ext2; apply prop_ext; split; intros [H | H];
[left; easy | right | left; easy | right]; split; [easy | | easy |].
destruct H as [H1 [H2 | H2]]; easy.
right; easy.
Qed.
Lemma graded_eq : ∀ {n}, graded eq (@eq 'G^n) = eq.
Proof.
intros; fun_ext2; apply prop_ext; split;
[intros [H | H] | intros; subst; right]; easy.
Qed.
Lemma graded_neq : ∀ {n}, graded neq (@neq 'G^n) = neq.
Proof.
intro; fun_ext2 x y; apply prop_ext; split.
intros [[H _] | H]; [unfold neq; contradict H; subst |]; easy.
intros H; destruct (eq_dec (sum x) (sum y)); [right | left]; easy.
Qed.
Lemma graded_irrefl_eq :
∀ {R} (HR : irreflexive R) {n} (Rn : 'G^n → 'G^n → Prop) x y,
graded R Rn x y ↔ R (sum x) (sum y) ∨ sum x = sum y ∧ Rn x y.
Proof.
move⇒ R /br_and_neq_id HR =>>; apply or_iff_compat_r; rewrite -{2}HR; easy.
Qed.
Lemma graded_irrefl_l :
∀ {R} (HR : irreflexive R) {n} (Rn : 'G^n → 'G^n → Prop) x y,
R (sum x) (sum y) → graded R Rn x y.
Proof.
move⇒ R /irrefl_equiv HR =>> H; apply graded_l;
[contradict H; apply HR |]; easy.
Qed.
End Graded_monomial_order_Facts1.
Section Graded_monomial_order_Facts2.
Compatibility results of graded monomial orders with operators on
homogeneous binary relations.
Context {G : AbelianMonoid}.
Lemma graded_conv :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
graded (converse R) (converse Rn) = converse (graded R Rn).
Proof.
intros; fun_ext2; apply prop_ext; split;
(intros [H | H]; [left; rewrite neq_sym_equiv | right]; easy).
Qed.
Lemma graded_compl :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
graded (complementary R) (complementary Rn) = complementary (graded R Rn).
Proof.
unfold complementary; intros; fun_ext2 x y;
apply prop_ext; rewrite not_or_equiv !not_and_equiv NNPP_equiv; split.
intros [H | H]; split; [right | left | left | right]; easy.
intros [[H1 | H1] [H2 | H2]]; [..| destruct (eq_dec (sum x) (sum y))];
[| right | left | right | left]; easy.
Qed.
Lemma graded_conv_compl :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
graded (conv_compl R) (conv_compl Rn) = conv_compl (graded R Rn).
Proof. intros; rewrite !conv_compl_eq graded_conv graded_compl; easy. Qed.
Lemma graded_br_and :
∀ {R1 R2 : G → G → Prop} {n} {R1n R2n : 'G^n → 'G^n → Prop},
graded (br_and R1 R2) (br_and R1n R2n) =
br_and (graded R1 R1n) (graded R2 R2n).
Proof.
intros; fun_ext2; apply prop_ext; split.
intros [[H1 [H2 H3]] | [H1 [H2 H3]]]; split; [left | left | right..]; easy.
intros [[H1 | H1] [H2 | H2]]; [left |..| right]; easy.
Qed.
Lemma graded_br_or :
∀ {R1 R2 : G → G → Prop} {n} {R1n R2n : 'G^n → 'G^n → Prop},
graded (br_or R1 R2) (br_or R1n R2n) =
br_or (graded R1 R1n) (graded R2 R2n).
Proof.
intros; fun_ext2; apply prop_ext; split.
intros [[H1 [H2 | H2]] | [H1 [H2 | H2]]];
[left; left | right; left | left; right | right; right]; easy.
intros [[H | H] | [H | H]]; [left | right | left | right]; (split; [easy |]);
[left | left | right | right]; easy.
Qed.
Lemma graded_br_and_neq :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
graded (br_and_neq R) (br_and_neq Rn) = br_and_neq (graded R Rn).
Proof. intros; rewrite !br_and_neq_eq graded_br_and graded_neq; easy. Qed.
Lemma graded_br_or_eq :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
graded (br_or_eq R) (br_or_eq Rn) = br_or_eq (graded R Rn).
Proof. intros; rewrite !br_or_eq_eq graded_br_or graded_eq; easy. Qed.
Lemma graded_strict :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
graded (strict R) (strict Rn) = strict (graded R Rn).
Proof. intros; rewrite !strict_eq graded_br_and graded_conv_compl; easy. Qed.
Lemma graded_equivalent :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
graded (equivalent R) (equivalent Rn) = equivalent (graded R Rn).
Proof. intros; rewrite !equivalent_eq graded_br_and graded_conv; easy. Qed.
Lemma graded_compar :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
graded (comparable R) (comparable Rn) = comparable (graded R Rn).
Proof. intros; rewrite !compar_eq graded_br_or graded_conv; easy. Qed.
Lemma graded_incompar :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
graded (incomparable R) (incomparable Rn) = incomparable (graded R Rn).
Proof.
move=>>; rewrite !incompar_eq graded_br_and
graded_compl graded_conv_compl; easy.
Qed.
End Graded_monomial_order_Facts2.
Section Graded_monomial_order_Facts3.
Compatibility results of graded monomial orders with elementary properties
of homogeneous binary relations.
Context {G : AbelianMonoid}.
Lemma graded_refl :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
reflexive Rn → reflexive (graded R Rn).
Proof. move=>> Hn x; right; easy. Qed.
Lemma graded_refl_equiv :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
reflexive (graded R Rn) ↔ reflexive Rn.
Proof.
intros; split; [| apply graded_refl].
intros H x; rewrite -graded_diag; apply H.
Qed.
Lemma graded_irrefl :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
irreflexive Rn → irreflexive (graded R Rn).
Proof. move=>> Hn x [[Hx _] | [_ Hx]]; [easy | apply (Hn _ Hx)]. Qed.
Lemma graded_irrefl_equiv :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
irreflexive (graded R Rn) ↔ irreflexive Rn.
Proof.
intros; split; [| apply graded_irrefl].
intros H x; rewrite -graded_diag; apply H.
Qed.
Lemma graded_refl_nil :
∀ R (R0 : 'G^0 → 'G^0 → Prop) (x y : 'G^0),
reflexive R0 → graded R R0 x y.
Proof.
intros R R0 x y H0; rewrite (hat0F_unit x _ y)//;
apply graded_refl_equiv; easy.
Qed.
Lemma graded_irrefl_nil :
∀ R (R0 : 'G^0 → 'G^0 → Prop) (x y : 'G^0),
irreflexive R0 → ¬ graded R R0 x y.
Proof.
intros R R0 x y H0; rewrite (hat0F_unit x _ y)//;
apply graded_irrefl_equiv; easy.
Qed.
Lemma graded_sym :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
symmetric R → symmetric Rn → symmetric (graded R Rn).
Proof.
move=>> /sym_equiv H /sym_equiv Hn x y [H1 | H1];
[left; rewrite neq_sym_equiv H | right; rewrite Hn]; easy.
Qed.
Lemma graded_antisym :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
antisymmetric R → antisymmetric Rn → antisymmetric (graded R Rn).
Proof.
move=>> H Hn x y [[H1 H2] | [H1 H2]] [[H3 H4] | [H3 H4]].
contradict H1; apply (H _ _ H2 H4).
rewrite H3 in H1; easy.
rewrite H1 in H3; easy.
apply (Hn _ _ H2 H4).
Qed.
Lemma graded_asym :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
asymmetric R → asymmetric Rn → asymmetric (graded R Rn).
Proof.
move=>>; rewrite !asym_equiv_irrefl_antisym; apply modus_ponens_and3;
[intros _; apply graded_irrefl | apply graded_antisym].
Qed.
Lemma graded_conn :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
connected R → connected Rn → connected (graded R Rn).
Proof.
move=>> H Hn x y H1; destruct (eq_dec (sum x) (sum y)) as [H2 | H2].
destruct (Hn _ _ H1) as [H3 | H3]; [left | right]; right; easy.
destruct (H (sum x) (sum y) H2) as [H3 | H3]; [left | right]; left;
[| split; [apply not_eq_sym |]]; easy.
Qed.
Lemma graded_str_conn :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
strongly_connected R → strongly_connected Rn →
strongly_connected (graded R Rn).
Proof.
intros R n Rn.
rewrite str_conn_equiv_refl_conn !str_conn_equiv_refl_conn.
apply modus_ponens_and3; [intros _; apply graded_refl | apply graded_conn].
Qed.
Lemma graded_tricho :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
trichotomous R → trichotomous Rn → trichotomous (graded R Rn).
Proof.
intros R n Rn.
rewrite tricho_equiv_asym_conn !tricho_equiv_asym_conn.
apply modus_ponens_and3; [apply graded_asym | apply graded_conn].
Qed.
Lemma graded_trans :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
transitive (br_and_neq R) → transitive Rn → transitive (graded R Rn).
Proof.
move=>> H Hn x y z [[H1 H2] | [H1 H2]] [[H3 H4] | [H3 H4]].
left; apply (H (sum x) (sum y) (sum z)); easy.
left; rewrite -H3; easy.
left; rewrite H1; easy.
right; split; [rewrite H1 | apply Hn with y]; easy.
Qed.
Lemma graded_neg_trans :
∀ {R : G → G → Prop} {n} {Rn : 'G^n → 'G^n → Prop},
negatively_transitive (br_or_eq R) → negatively_transitive Rn →
negatively_transitive (graded R Rn).
Proof.
move=>> H Hn =>>; rewrite -!compl_alt -graded_compl//.
apply graded_trans; [rewrite br_and_neq_compl |]; easy.
Qed.
End Graded_monomial_order_Facts3.
Section Graded_monomial_order_Facts4.
Compatibility results of graded monomial orders with compound properties
of homogeneous binary relations.
Context {G : AbelianMonoid}.
Variable R : G → G → Prop.
Context {n : nat}.
Variable Rn : 'G^n → 'G^n → Prop.
Lemma graded_po :
partial_order R → partial_order Rn → partial_order (graded R Rn).
Proof.
intros H Hn; repeat split.
apply graded_trans; [apply br_and_neq_trans; apply H | apply Hn].
apply graded_refl, Hn.
apply graded_antisym; [apply H | apply Hn].
Qed.
Lemma graded_to : total_order R → total_order Rn → total_order (graded R Rn).
Proof.
rewrite to_equiv_po !to_equiv_po; apply modus_ponens_and3;
[apply graded_po | apply graded_conn; easy].
Qed.
Lemma graded_spo :
strict_partial_order R → strict_partial_order Rn →
strict_partial_order (graded R Rn).
Proof.
intros H Hn; rewrite spo_equiv_no_asym; split.
apply graded_trans; [| apply Hn].
apply br_and_neq_trans; [apply asym_antisym |]; apply H.
apply graded_irrefl, Hn.
Qed.
Lemma graded_sto :
strict_total_order R → strict_total_order Rn →
strict_total_order (graded R Rn).
Proof.
rewrite !sto_equiv_spo; apply modus_ponens_and3;
[apply graded_spo | apply graded_conn; easy].
Qed.
End Graded_monomial_order_Facts4.
Section Graded_monomial_order_Facts5.
Compatibility results of graded monomial orders with monomial properties.
Context {G : AbelianMonoid}.
Hypothesis HG1 : @plus_is_reg_r G.
Variable R : G → G → Prop.
Context {n : nat}.
Variable Rn : 'G^n → 'G^n → Prop.
Lemma graded_br_plus_compat_r :
br_plus_compat_r R → br_plus_compat_r Rn →
br_plus_compat_r (graded R Rn).
Proof.
intros H Hn x x1 x2 [[Hx1 Hx2] | [Hx1 Hx2]].
left; rewrite !sum_plus; split;
[contradict Hx1; apply (HG1 (sum x)) | apply H]; easy.
right; split; [rewrite !sum_plus Hx1 | apply Hn]; easy.
Qed.
Lemma graded_br_plus_compat_l :
br_plus_compat_l R → br_plus_compat_l Rn →
br_plus_compat_l (graded R Rn).
Proof. rewrite !br_plus_compat_equiv; apply graded_br_plus_compat_r. Qed.
Lemma graded_zero_is_left :
zero_is_left R → zero_is_left Rn → zero_is_left (graded R Rn).
Proof.
intros H Hn x Hx; destruct (eq_dec (sum x) 0) as [Hx1 | Hx1].
right; rewrite sum_zero Hx1; split; [| apply Hn]; easy.
left; rewrite sum_zero; split; [contradict Hx1 | apply H]; easy.
Qed.
Lemma graded_zero_is_right :
zero_is_right R → zero_is_right Rn → zero_is_right (graded R Rn).
Proof.
intros H Hn x Hx; destruct (eq_dec (sum x) 0) as [Hx1 | Hx1].
right; rewrite sum_zero Hx1; split; [| apply Hn]; easy.
left; rewrite sum_zero; split; [contradict Hx1 | apply H]; easy.
Qed.
Lemma graded_br_monoid_compat_zl :
br_monoid_compat_zl R → br_monoid_compat_zl Rn →
br_monoid_compat_zl (graded R Rn).
Proof.
apply modus_ponens_and3;
[apply graded_br_plus_compat_r | apply graded_zero_is_left].
Qed.
Lemma graded_br_monoid_compat_zr :
br_monoid_compat_zr R → br_monoid_compat_zr Rn →
br_monoid_compat_zr (graded R Rn).
Proof.
apply modus_ponens_and3;
[apply graded_br_plus_compat_r | apply graded_zero_is_right].
Qed.
Lemma graded_mo :
monomial_order R → monomial_order Rn → monomial_order (graded R Rn).
Proof.
apply modus_ponens_and3;
[apply graded_sto | apply graded_br_plus_compat_r]; easy.
Qed.
Lemma graded_mozl :
monomial_order_zl R → monomial_order_zl Rn →
monomial_order_zl (graded R Rn).
Proof.
apply modus_ponens_and3;
[apply graded_sto | apply graded_br_monoid_compat_zl]; easy.
Qed.
Lemma graded_mozr :
monomial_order_zr R → monomial_order_zr Rn →
monomial_order_zr (graded R Rn).
Proof.
apply modus_ponens_and3;
[apply graded_sto | apply graded_br_monoid_compat_zr]; easy.
Qed.
End Graded_monomial_order_Facts5.
Section Graded_monomial_order_defs.
Context {G : AbelianMonoid}.
Variable R : G → G → Prop.
Context {n : nat}.
Definition grlex := graded R (@lex G R n).
Definition grcolex := graded R (@colex G R n).
Definition grsymlex := graded R (@symlex G R n).
Definition grevlex := graded R (@revlex G R n).
End Graded_monomial_order_defs.
Section Graded_lex_order_Facts1.
General properties of graded lexicographic orders.
Context {G : AbelianMonoid}.
Hypothesis HG1 : @plus_is_reg_r G.
Lemma grlex_S :
∀ R {n} (x y : 'G^n.+1),
grlex R x y ↔
sum x ≠ sum y ∧ R (sum x) (sum y) ∨
sum x = sum y ∧ x ord0 ≠ y ord0 ∧ R (x ord0) (y ord0) ∨
sum x = sum y ∧ x ord0 = y ord0 ∧
grlex R (skipF0 x) (skipF0 y).
Proof.
intros; unfold grlex, graded at 1; rewrite lex_S and_or_l;
do 2 apply or_iff_compat_l; split; intros [H1 [H2 H3]];
(repeat split; [easy.. |]); move: H3; apply graded_S_r_equiv; easy.
Qed.
Lemma grcolex_S :
∀ R {n} (x y : 'G^n.+1),
grcolex R x y ↔
sum x ≠ sum y ∧ R (sum x) (sum y) ∨
sum x = sum y ∧ x ord_max ≠ y ord_max ∧ R (x ord_max) (y ord_max) ∨
sum x = sum y ∧ x ord_max = y ord_max ∧
grcolex R (skipFmax x) (skipFmax y).
Proof.
intros; unfold grcolex, graded at 1; rewrite colex_S and_or_l.
do 2 apply or_iff_compat_l; split; intros [H1 [H2 H3]];
(repeat split; [easy.. |]); move: H3; apply graded_S_r_equiv; easy.
Qed.
Lemma grsymlex_S :
∀ R {n} (x y : 'G^n.+1),
grsymlex R x y ↔
sum x ≠ sum y ∧ R (sum x) (sum y) ∨
sum x = sum y ∧ y ord0 ≠ x ord0 ∧ R (y ord0) (x ord0) ∨
sum x = sum y ∧ y ord0 = x ord0 ∧
grsymlex R (skipF0 x) (skipF0 y).
Proof.
intros; unfold grsymlex, graded at 1; rewrite symlex_S and_or_l.
do 2 (apply or_iff_compat; [easy |]); split; intros [H1 [H2 H3]];
(repeat split; [easy.. |]); move: H3; apply graded_S_r_equiv; easy.
Qed.
Let H0 : ∀ P Q R T, (P ∧ Q ∨ P ∧ R ↔ P ∧ T) ↔ (P → Q ∨ R ↔ T).
Proof. tauto. Qed.
"mo" stands for "monomial_order".
Lemma grsymlex_S_mo :
∀ R {n} (x y : 'G^n.+1),
monomial_order R →
grsymlex R x y ↔
sum x ≠ sum y ∧ R (sum x) (sum y) ∨
sum x = sum y ∧ grsymlex R (skipF0 x) (skipF0 y).
Proof.
intros R n x y HR.
assert (HG1' : @plus_is_reg_r G) by now apply (mo_plus_is_reg_r R).
rewrite grsymlex_S; apply or_iff_compat_l; apply H0; intros H1; split.
move⇒ [[/eq_sym_equiv H2 H3] | H2]; [| easy]; apply graded_l.
contradict H2; move: H1; rewrite !(sum_skipF ord0) H2; apply HG1'.
apply br_sum_conn_equiv; easy.
intros H2; destruct (eq_dec (x ord0) (y ord0)) as [H3 | H3].
right; repeat split; easy.
left; repeat split; [easy.. |].
apply graded_l_rev, br_sum_conn_equiv in H2; [easy.. |].
contradict H3; move: H1; rewrite !(sum_skipF ord0) H3; apply HG1'.
Qed.
Lemma grevlex_S :
∀ R {n} (x y : 'G^n.+1),
grevlex R x y ↔
sum x ≠ sum y ∧ R (sum x) (sum y) ∨
sum x = sum y ∧ y ord_max ≠ x ord_max ∧ R (y ord_max) (x ord_max) ∨
sum x = sum y ∧ y ord_max = x ord_max ∧
grevlex R (skipFmax x) (skipFmax y).
Proof.
intros; unfold grevlex,graded at 1; rewrite revlex_S and_or_l.
do 2 (apply or_iff_compat; [easy |]); split; intros [H1 [H2 H3]];
(repeat split; [easy.. |]); move: H3; apply graded_S_r_equiv; easy.
Qed.
Lemma grevlex_S_mo :
∀ R {n} (x y : 'G^n.+1),
monomial_order R →
grevlex R x y ↔
sum x ≠ sum y ∧ R (sum x) (sum y) ∨
sum x = sum y ∧ grevlex R (skipFmax x) (skipFmax y).
Proof.
intros R n x y HR.
assert (HG1' : @plus_is_reg_r G) by now apply (mo_plus_is_reg_r R).
rewrite grevlex_S; apply or_iff_compat_l; apply H0; intros H1; split.
move⇒ [[/eq_sym_equiv H2 H3] | H2]; [| easy]; apply graded_l.
contradict H2; move: H1; rewrite !(sum_skipF ord_max) H2; apply HG1'.
apply br_sum_conn_equiv; easy.
intros H2; destruct (eq_dec (x ord_max) (y ord_max)) as [H3 | H3].
right; repeat split; easy.
left; repeat split; [easy.. |].
apply graded_l_rev, br_sum_conn_equiv in H2; [easy.. |].
contradict H3; move: H1; rewrite !(sum_skipF ord_max) H3; apply HG1'.
Qed.
∀ R {n} (x y : 'G^n.+1),
monomial_order R →
grsymlex R x y ↔
sum x ≠ sum y ∧ R (sum x) (sum y) ∨
sum x = sum y ∧ grsymlex R (skipF0 x) (skipF0 y).
Proof.
intros R n x y HR.
assert (HG1' : @plus_is_reg_r G) by now apply (mo_plus_is_reg_r R).
rewrite grsymlex_S; apply or_iff_compat_l; apply H0; intros H1; split.
move⇒ [[/eq_sym_equiv H2 H3] | H2]; [| easy]; apply graded_l.
contradict H2; move: H1; rewrite !(sum_skipF ord0) H2; apply HG1'.
apply br_sum_conn_equiv; easy.
intros H2; destruct (eq_dec (x ord0) (y ord0)) as [H3 | H3].
right; repeat split; easy.
left; repeat split; [easy.. |].
apply graded_l_rev, br_sum_conn_equiv in H2; [easy.. |].
contradict H3; move: H1; rewrite !(sum_skipF ord0) H3; apply HG1'.
Qed.
Lemma grevlex_S :
∀ R {n} (x y : 'G^n.+1),
grevlex R x y ↔
sum x ≠ sum y ∧ R (sum x) (sum y) ∨
sum x = sum y ∧ y ord_max ≠ x ord_max ∧ R (y ord_max) (x ord_max) ∨
sum x = sum y ∧ y ord_max = x ord_max ∧
grevlex R (skipFmax x) (skipFmax y).
Proof.
intros; unfold grevlex,graded at 1; rewrite revlex_S and_or_l.
do 2 (apply or_iff_compat; [easy |]); split; intros [H1 [H2 H3]];
(repeat split; [easy.. |]); move: H3; apply graded_S_r_equiv; easy.
Qed.
Lemma grevlex_S_mo :
∀ R {n} (x y : 'G^n.+1),
monomial_order R →
grevlex R x y ↔
sum x ≠ sum y ∧ R (sum x) (sum y) ∨
sum x = sum y ∧ grevlex R (skipFmax x) (skipFmax y).
Proof.
intros R n x y HR.
assert (HG1' : @plus_is_reg_r G) by now apply (mo_plus_is_reg_r R).
rewrite grevlex_S; apply or_iff_compat_l; apply H0; intros H1; split.
move⇒ [[/eq_sym_equiv H2 H3] | H2]; [| easy]; apply graded_l.
contradict H2; move: H1; rewrite !(sum_skipF ord_max) H2; apply HG1'.
apply br_sum_conn_equiv; easy.
intros H2; destruct (eq_dec (x ord_max) (y ord_max)) as [H3 | H3].
right; repeat split; easy.
left; repeat split; [easy.. |].
apply graded_l_rev, br_sum_conn_equiv in H2; [easy.. |].
contradict H3; move: H1; rewrite !(sum_skipF ord_max) H3; apply HG1'.
Qed.
Monomial properties of graded monomial orders with .
Lemma grlex_insertF :
∀ {R n} i a b (x y : 'G^n),
irreflexive R → transitive R → br_plus_compat_l R → br_or_eq R a b →
grlex R x y → grlex R (insertF i a x) (insertF i b y).
Proof.
move=>> HR0 HR1 HR2 H3 [[H1 H2] | [H1 H2]].
apply graded_irrefl_l; [| rewrite 2!sum_insertF]; try easy.
destruct H3 as [H3'|H3'];[subst; apply HR2; easy|idtac].
apply br_plus_compat2_r; try apply br_plus_compat_equiv; easy.
destruct H3 as [H3'|H3'];[subst|idtac].
right; split; [rewrite 2!sum_insertF H1 | apply lex_insertF; try apply br_or_eq_refl]; easy.
apply graded_irrefl_l; [| rewrite 2!sum_insertF]; try easy.
rewrite H1; apply br_plus_compat_equiv; easy.
Qed.
Lemma grcolex_insertF :
∀ {R n} i a b (x y : 'G^n),
irreflexive R → transitive R → br_plus_compat_l R → br_or_eq R a b →
grcolex R x y → grcolex R (insertF i a x) (insertF i b y).
Proof.
move=>> HR0 HR1 HR2 H3 [[H1 H2] | [H1 H2]].
apply graded_irrefl_l; [| rewrite 2!sum_insertF]; try easy.
destruct H3 as [H3'|H3'];[subst; apply HR2; easy|idtac].
apply br_plus_compat2_r; try apply br_plus_compat_equiv; easy.
destruct H3 as [H3'|H3'];[subst|idtac].
right; split; [rewrite 2!sum_insertF H1 | apply colex_insertF; try apply br_or_eq_refl]; easy.
apply graded_irrefl_l; [| rewrite 2!sum_insertF]; try easy.
rewrite H1; apply br_plus_compat_equiv; easy.
Qed.
Lemma grsymlex_insertF :
∀ {R n} i a b (x y : 'G^n),
irreflexive R → transitive R → br_plus_compat_l R → br_or_eq R a b →
grsymlex R x y → grsymlex R (insertF i a x) (insertF i b y).
Proof.
move=>> HR0 HR1 HR2 H3 [[H1 H2] | [H1 H2]].
apply graded_irrefl_l; [| rewrite 2!sum_insertF]; try easy.
destruct H3 as [H3'|H3'];[subst; apply HR2; easy|idtac].
apply br_plus_compat2_r; try apply br_plus_compat_equiv; easy.
destruct H3 as [H3'|H3'];[subst|idtac].
right; split; [rewrite 2!sum_insertF H1 | apply symlex_insertF; try apply br_or_eq_refl]; easy.
apply graded_irrefl_l; [| rewrite 2!sum_insertF]; try easy.
rewrite H1; apply br_plus_compat_equiv; easy.
Qed.
Lemma grevlex_insertF :
∀ {R n} i a b (x y : 'G^n),
irreflexive R → transitive R → br_plus_compat_l R → br_or_eq R a b →
grevlex R x y → grevlex R (insertF i a x) (insertF i b y).
Proof.
move=>> HR0 HR1 HR2 H3 [[H1 H2] | [H1 H2]].
apply graded_irrefl_l; [| rewrite 2!sum_insertF]; try easy.
destruct H3 as [H3'|H3'];[subst; apply HR2; easy|idtac].
apply br_plus_compat2_r; try apply br_plus_compat_equiv; easy.
destruct H3 as [H3'|H3'];[subst|idtac].
right; split; [rewrite 2!sum_insertF H1 | apply revlex_insertF; try apply br_or_eq_refl]; easy.
apply graded_irrefl_l; [| rewrite 2!sum_insertF]; try easy.
rewrite H1; apply br_plus_compat_equiv; easy.
Qed.
Lemma grlex_br_plus_compat_l :
∀ R {n}, br_plus_compat_l R → br_plus_compat_l (@grlex G R n).
Proof.
intros; apply graded_br_plus_compat_l; [easy.. |].
apply lex_br_plus_compat_l; easy.
Qed.
Lemma grcolex_br_plus_compat_l :
∀ R {n}, br_plus_compat_l R → br_plus_compat_l (@grcolex G R n).
Proof.
intros; apply graded_br_plus_compat_l; [easy.. |].
apply colex_br_plus_compat_l; easy.
Qed.
Lemma grsymlex_br_plus_compat_l :
∀ R {n}, br_plus_compat_l R → br_plus_compat_l (@grsymlex G R n).
Proof.
intros; apply graded_br_plus_compat_l; [easy.. |].
apply symlex_br_plus_compat_l; easy.
Qed.
Lemma grevlex_br_plus_compat_l :
∀ R {n}, br_plus_compat_l R → br_plus_compat_l (@grevlex G R n).
Proof.
intros; apply graded_br_plus_compat_l; [easy.. |].
apply revlex_br_plus_compat_l; easy.
Qed.
Lemma grlex_mo :
∀ R {n : nat}, monomial_order R → monomial_order (@grlex G R n).
Proof. intros; apply graded_mo; [..| apply lex_mo]; easy. Qed.
Lemma grcolex_mo :
∀ R {n : nat}, monomial_order R → monomial_order (@grcolex G R n).
Proof. intros; apply graded_mo; [..| apply colex_mo]; easy. Qed.
Lemma grsymlex_mo :
∀ R {n : nat}, monomial_order R → monomial_order (@grsymlex G R n).
Proof. intros; apply graded_mo; [..| apply symlex_mo]; easy. Qed.
Lemma grevlex_mo :
∀ R {n : nat}, monomial_order R → monomial_order (@grevlex G R n).
Proof. intros; apply graded_mo; [..| apply revlex_mo]; easy. Qed.
End Graded_lex_order_Facts1.
Notation grlex_lt := (grlex lt).
Notation grcolex_lt := (grcolex lt).
Notation grsymlex_lt := (grsymlex lt).
Notation grevlex_lt := (grevlex lt).
Section Graded_monomial_order_nat_Facts.
Graded monomial orders on the integer numbers.
Let HN0 := @inhabited_m nat_AbelianMonoid.
Let HN1 := nat_plus_reg_r.
Let Hlt := lt_mo.
Lemma lt_sum_conn_equiv :
∀ {n i0} {u v : 'nat^n.+1}, sum u = sum v →
(u i0 < v i0)%coq_nat ↔ (sum (skipF i0 v) < sum (skipF i0 u))%coq_nat.
Proof. intros; apply br_sum_conn_equiv; easy. Qed.
Lemma grlex_lt_eq :
∀ {n} (x y : 'nat^n),
grlex_lt x y ↔
(sum x < sum y)%coq_nat ∨ sum x = sum y ∧ lex_lt x y.
Proof. intros; apply graded_irrefl_eq, lt_irrefl. Qed.
Lemma grcolex_lt_eq :
∀ {n} (x y : 'nat^n),
grcolex_lt x y ↔
(sum x < sum y)%coq_nat ∨ sum x = sum y ∧ colex_lt x y.
Proof. intros; apply graded_irrefl_eq, lt_irrefl. Qed.
Lemma grsymlex_lt_eq :
∀ {n} (x y : 'nat^n),
grsymlex_lt x y ↔
(sum x < sum y)%coq_nat ∨ sum x = sum y ∧ symlex_lt x y.
Proof. intros; apply graded_irrefl_eq, lt_irrefl. Qed.
Lemma grevlex_lt_eq :
∀ {n} (x y : 'nat^n),
grevlex_lt x y ↔
(sum x < sum y)%coq_nat ∨ sum x = sum y ∧ revlex_lt x y.
Proof. intros; apply graded_irrefl_eq, lt_irrefl. Qed.
Lemma grlex_lt_l :
∀ {n} (x y : 'nat^n), (sum x < sum y)%coq_nat → grlex_lt x y.
Proof. move=>>; apply graded_irrefl_l, lt_irrefl. Qed.
Lemma grcolex_lt_l :
∀ {n} (x y : 'nat^n), (sum x < sum y)%coq_nat → grcolex_lt x y.
Proof. move=>>; apply graded_irrefl_l, lt_irrefl. Qed.
Lemma grsymlex_lt_l :
∀ {n} (x y : 'nat^n), (sum x < sum y)%coq_nat → grsymlex_lt x y.
Proof. move=>>; apply graded_irrefl_l, lt_irrefl. Qed.
Lemma grevlex_lt_l :
∀ {n} (x y : 'nat^n), (sum x < sum y)%coq_nat → grevlex_lt x y.
Proof. move=>>; apply graded_irrefl_l, lt_irrefl. Qed.
Lemma grlex_lt_nil : ∀ (x y : 'nat^0), ¬ grlex_lt x y.
Proof. intros; apply graded_irrefl_nil, lex_lt_sto. Qed.
Lemma grcolex_lt_nil : ∀ (x y : 'nat^0), ¬ grcolex_lt x y.
Proof. intros; apply graded_irrefl_nil, colex_lt_sto. Qed.
Lemma grsymlex_lt_nil : ∀ (x y : 'nat^0), ¬ grsymlex_lt x y.
Proof. intros; apply graded_irrefl_nil, symlex_lt_sto. Qed.
Lemma grevlex_lt_nil : ∀ (x y : 'nat^0), ¬ grevlex_lt x y.
Proof. intros; apply graded_irrefl_nil, revlex_lt_sto. Qed.
Lemma grlex_lt_S :
∀ {n : nat} (x y : 'nat^n.+1),
grlex_lt x y ↔
(sum x < sum y)%coq_nat ∨
sum x = sum y ∧ (x ord0 < y ord0)%coq_nat ∨
sum x = sum y ∧ x ord0 = y ord0 ∧ grlex_lt (skipF0 x) (skipF0 y).
Proof.
intros; rewrite grlex_S//; apply or_iff_compat;
[| apply or_iff_compat_r, and_iff_compat_l];
apply br_and_neq_id, lt_irrefl.
Qed.
Lemma grcolex_lt_S :
∀ {n : nat} (x y : 'nat^n.+1),
grcolex_lt x y ↔
(sum x < sum y)%coq_nat ∨
sum x = sum y ∧ (x ord_max < y ord_max)%coq_nat ∨
sum x = sum y ∧ x ord_max = y ord_max ∧
grcolex_lt (skipFmax x) (skipFmax y).
Proof.
intros; rewrite grcolex_S//; apply or_iff_compat;
[| apply or_iff_compat_r, and_iff_compat_l];
apply br_and_neq_id, lt_irrefl.
Qed.
Lemma grsymlex_lt_S :
∀ {n : nat} (x y : 'nat^n.+1),
grsymlex_lt x y ↔
(sum x < sum y)%coq_nat ∨
sum x = sum y ∧ grsymlex_lt (skipF0 x) (skipF0 y).
Proof.
intros; rewrite grsymlex_S_mo//;
apply or_iff_compat_r, br_and_neq_id, lt_irrefl.
Qed.
Lemma grevlex_lt_S :
∀ {n : nat} (x y : 'nat^n.+1),
grevlex_lt x y ↔
(sum x < sum y)%coq_nat ∨
sum x = sum y ∧ grevlex_lt (skipFmax x) (skipFmax y).
Proof.
intros; rewrite grevlex_S_mo//;
apply or_iff_compat_r, br_and_neq_id, lt_irrefl.
Qed.
Lemma grlex_lt_insertF :
∀ {n} i a b (x y : 'nat^n), (a ≤ b)%coq_nat →
grlex_lt x y → grlex_lt (insertF i a x) (insertF i b y).
Proof.
move=>>; rewrite -br_or_eq_lt; apply grlex_insertF;
[apply lt_sto.. | apply lt_plus_compat_l].
Qed.
Lemma grcolex_lt_insertF :
∀ {n} i a b (x y : 'nat^n), (a ≤ b)%coq_nat →
grcolex_lt x y → grcolex_lt (insertF i a x) (insertF i b y).
Proof.
move=>>; rewrite -br_or_eq_lt; apply grcolex_insertF;
[apply lt_sto.. | apply lt_plus_compat_l].
Qed.
Lemma grsymlex_lt_insertF :
∀ {n} i a b (x y : 'nat^n), (a ≤ b)%coq_nat →
grsymlex_lt x y → grsymlex_lt (insertF i a x) (insertF i b y).
Proof.
move=>>; rewrite -br_or_eq_lt; apply grsymlex_insertF;
[apply lt_sto.. | apply lt_plus_compat_l].
Qed.
Lemma grevlex_lt_insertF :
∀ {n} i a b (x y : 'nat^n), (a ≤ b)%coq_nat →
grevlex_lt x y → grevlex_lt (insertF i a x) (insertF i b y).
Proof.
move=>>; rewrite -br_or_eq_lt; apply grevlex_insertF;
[apply lt_sto.. | apply lt_plus_compat_l].
Qed.
Lemma grlex_lt_sto :
∀ {n}, strict_total_order (grlex_lt : 'nat^n → 'nat^n → Prop).
Proof. intro; apply graded_sto; [apply lt_sto | apply lex_lt_sto]. Qed.
Lemma grcolex_lt_sto :
∀ {n}, strict_total_order (grcolex_lt : 'nat^n → 'nat^n → Prop).
Proof. intro; apply graded_sto; [apply lt_sto | apply colex_lt_sto]. Qed.
Lemma grsymlex_lt_sto :
∀ {n}, strict_total_order (grsymlex_lt : 'nat^n → 'nat^n → Prop).
Proof. intro; apply graded_sto; [apply lt_sto | apply symlex_lt_sto]. Qed.
Lemma grevlex_lt_sto :
∀ {n}, strict_total_order (grevlex_lt : 'nat^n → 'nat^n → Prop).
Proof. intro; apply graded_sto; [apply lt_sto | apply revlex_lt_sto]. Qed.
Lemma grlex_lt_zl :
∀ {n}, zero_is_left (grlex_lt : 'nat^n → 'nat^n → Prop).
Proof.
move=>> H; apply grlex_lt_l; rewrite sum_zero;
apply Nat.neq_0_lt_0, sum_def_nat_contra; easy.
Qed.
Lemma grcolex_lt_zl :
∀ {n}, zero_is_left (grcolex_lt : 'nat^n → 'nat^n → Prop).
Proof.
move=>> H; apply grcolex_lt_l; rewrite sum_zero;
apply Nat.neq_0_lt_0, sum_def_nat_contra; easy.
Qed.
Lemma grsymlex_lt_zl :
∀ {n}, zero_is_left (grsymlex_lt : 'nat^n → 'nat^n → Prop).
Proof.
move=>> H; apply grsymlex_lt_l; rewrite sum_zero;
apply Nat.neq_0_lt_0, sum_def_nat_contra; easy.
Qed.
Lemma grevlex_lt_zl :
∀ {n}, zero_is_left (grevlex_lt : 'nat^n → 'nat^n → Prop).
Proof.
move=>> H; apply grevlex_lt_l; rewrite sum_zero;
apply Nat.neq_0_lt_0, sum_def_nat_contra; easy.
Qed.
Lemma grlex_lt_mul :
∀ {n l} (Hl : l ≠ 0) (x y : 'nat^n),
grlex_lt x y → grlex_lt (mapF (Nat.mul l) x) (mapF (Nat.mul l) y).
Proof.
move⇒ n l /Nat.neq_0_lt_0 Hl x y H; induction n as [| n IHn];
[contradict H; apply grlex_lt_nil |].
rewrite grlex_lt_S in H; destruct H as [H | [H | H]].
apply grlex_lt_l; rewrite !sum_mul; apply Nat.mul_lt_mono_pos_l; easy.
rewrite grlex_lt_S; right; left; rewrite !sum_mul !mapF_correct; split;
[f_equal | apply Nat.mul_lt_mono_pos_l]; easy.
rewrite grlex_lt_S; right; right; rewrite !sum_mul !mapF_correct; repeat split;
[f_equal.. | apply IHn]; easy.
Qed.
Lemma grcolex_lt_mul :
∀ {n l} (Hl : l ≠ 0) (x y : 'nat^n),
grcolex_lt x y → grcolex_lt (mapF (Nat.mul l) x) (mapF (Nat.mul l) y).
Proof.
move⇒ n l /Nat.neq_0_lt_0 Hl x y H; induction n as [| n IHn];
[contradict H; apply grcolex_lt_nil |].
rewrite grcolex_lt_S in H; destruct H as [H | [H | H]].
apply grcolex_lt_l; rewrite !sum_mul; apply Nat.mul_lt_mono_pos_l; easy.
rewrite grcolex_lt_S; right; left; rewrite !sum_mul !mapF_correct; split;
[f_equal | apply Nat.mul_lt_mono_pos_l]; easy.
rewrite grcolex_lt_S; right; right; rewrite !sum_mul !mapF_correct; repeat split;
[f_equal.. | apply IHn]; easy.
Qed.
Lemma grsymlex_lt_mul :
∀ {n l} (Hl : l ≠ 0) (x y : 'nat^n),
grsymlex_lt x y → grsymlex_lt (mapF (Nat.mul l) x) (mapF (Nat.mul l) y).
Proof.
move⇒ n l /Nat.neq_0_lt_0 Hl x y H; induction n as [| n IHn];
[contradict H; apply grsymlex_lt_nil |].
rewrite grsymlex_lt_S in H; destruct H as [H | H].
apply grsymlex_lt_l; rewrite !sum_mul; apply Nat.mul_lt_mono_pos_l; easy.
rewrite grsymlex_lt_S; right; rewrite !sum_mul; split;
[f_equal | apply IHn]; easy.
Qed.
Lemma grevlex_lt_mul :
∀ {n l} (Hl : l ≠ 0) (x y : 'nat^n),
grevlex_lt x y → grevlex_lt (mapF (Nat.mul l) x) (mapF (Nat.mul l) y).
Proof.
move⇒ n l /Nat.neq_0_lt_0 Hl x y H; induction n as [| n IHn];
[contradict H; apply grevlex_lt_nil |].
rewrite grevlex_lt_S in H; destruct H as [H | H].
apply grevlex_lt_l; rewrite !sum_mul; apply Nat.mul_lt_mono_pos_l; easy.
rewrite grevlex_lt_S; right; rewrite !sum_mul; split;
[f_equal | apply IHn]; easy.
Qed.
Lemma grlex_lt_mo :
∀ {n}, monomial_order (grlex_lt : 'nat^n → 'nat^n → Prop).
Proof. intro; now apply grlex_mo. Qed.
Lemma grcolex_lt_mo :
∀ {n}, monomial_order (grcolex_lt : 'nat^n → 'nat^n → Prop).
Proof. intro; now apply grcolex_mo. Qed.
Lemma grsymlex_lt_mo :
∀ {n}, monomial_order (grsymlex_lt : 'nat^n → 'nat^n → Prop).
Proof. intro; now apply grsymlex_mo. Qed.
Lemma grevlex_lt_mo :
∀ {n}, monomial_order (grevlex_lt : 'nat^n → 'nat^n → Prop).
Proof. intro; now apply grevlex_mo. Qed.
Lemma grsymlex_sortedF_itemF :
∀ {n} k, k ≠ 0 → sortedF grsymlex_lt (fun i ⇒ itemF n i k).
Proof.
intros n k Hk i j H; right; split; [rewrite 2!sum_itemF; easy |].
apply symlex_sortedF_itemF;
[apply lt_trans | apply lt_antisym | | apply Nat.neq_0_lt_0 |]; easy.
Qed.
End Graded_monomial_order_nat_Facts.