Skip to content

Commit f3fa8ca

Browse files
committed
[WIP] replace the infrastructure of mpoly with monalg
1 parent 3a08297 commit f3fa8ca

File tree

2 files changed

+611
-1128
lines changed

2 files changed

+611
-1128
lines changed

src/monalg.v

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Reserved Notation "<< k >>" (format "<< k >>").
4444
Reserved Notation "g @_ k"
4545
(at level 3, k at level 2, left associativity, format "g @_ k").
4646
Reserved Notation "c %:MP" (format "c %:MP").
47-
Reserved Notation "''X_{1..' n '}'".
47+
Reserved Notation "''X_{1..' n '}'" (n at level 2).
4848
Reserved Notation "'U_(' n )" (format "'U_(' n )").
4949
Reserved Notation "x ^[ f , g ]" (at level 1, format "x ^[ f , g ]").
5050

@@ -986,6 +986,9 @@ HB.instance Definition _ :=
986986
HB.instance Definition _ :=
987987
GRing.LSemiModule_isLSemiAlgebra.Build R {malg R[K]} (@fgscaleAl K R).
988988

989+
(* FIXME: HB.saturate *)
990+
HB.instance Definition _ := GRing.RMorphism.on (mcoeff 1 : {malg R[K]} -> R).
991+
989992
End MalgNzSemiRingTheory.
990993

991994
(* -------------------------------------------------------------------- *)
@@ -1294,7 +1297,7 @@ Arguments monalgOver_pred _ _ _ _ /.
12941297

12951298
(* -------------------------------------------------------------------- *)
12961299
HB.mixin Record isMeasure (M : monomType) (mf : M -> nat) := {
1297-
mf0 : mf 1%M = 0%N;
1300+
mf1 : mf 1%M = 0%N;
12981301
mfM : {morph mf : m1 m2 / (m1 * m2)%M >-> (m1 + m2)%N};
12991302
mf_eq0I : forall m, mf m = 0%N -> m = 1%M
13001303
}.
@@ -1314,7 +1317,7 @@ Context (M : monomType) (G : nmodType) (mf : measure M).
13141317
Implicit Types (g : {malg G[M]}).
13151318

13161319
Lemma mf_eq0 m : (mf m == 0%N) = (m == 1%M).
1317-
Proof. by apply/eqP/eqP=> [|->]; rewrite ?mf0 // => /mf_eq0I. Qed.
1320+
Proof. by apply/eqP/eqP=> [|->]; rewrite ?mf1 // => /mf_eq0I. Qed.
13181321

13191322
Definition mmeasure g := (\max_(m <- msupp g) (mf m).+1)%N.
13201323

@@ -1336,7 +1339,7 @@ Proof. by apply/contraTN=> /mmeasure_mnm_lt; rewrite leqNgt ltnS. Qed.
13361339
Lemma mmeasureC c : mmeasure c%:MP = (c != 0%R) :> nat.
13371340
Proof.
13381341
rewrite mmeasureE msuppC; case: (_ == 0)=> /=.
1339-
by rewrite big_nil. by rewrite big_seq_fset1 mf0.
1342+
by rewrite big_nil. by rewrite big_seq_fset1 mf1.
13401343
Qed.
13411344

13421345
Lemma mmeasureD_le g1 g2 :
@@ -1395,6 +1398,8 @@ Canonical cmonom_unlockable k := [unlockable fun cmonom_of_fsfun k].
13951398

13961399
End CmonomDef.
13971400

1401+
Bind Scope monom_scope with cmonom.
1402+
13981403
Notation "{ 'cmonom' I }" := (cmonom I) : type_scope.
13991404
Notation "''X_{1..' n '}'" := (cmonom 'I_n) : type_scope.
14001405
Notation "{ 'mpoly' R [ n ] }" := {malg R['X_{1..n}]} : type_scope.
@@ -1412,8 +1417,8 @@ Section CmonomCanonicals.
14121417

14131418
Context (I : choiceType).
14141419

1415-
HB.instance Definition _ := [isNew for @cmonom_val I].
1416-
HB.instance Definition _ := [Choice of cmonom I by <:].
1420+
#[hnf] HB.instance Definition _ := [isNew for @cmonom_val I].
1421+
#[hnf] HB.instance Definition _ := [Choice of cmonom I by <:].
14171422

14181423
(* -------------------------------------------------------------------- *)
14191424
Implicit Types (m : cmonom I).
@@ -1426,7 +1431,7 @@ Proof.
14261431
by rewrite [mkcmonom]unlock.
14271432
Qed.
14281433

1429-
Lemma cmP m1 m2 : reflect (forall i, m1 i = m2 i) (m1 == m2).
1434+
Lemma cmP m1 m2 : reflect (m1 =1 m2) (m1 == m2).
14301435
Proof. by apply: (iffP eqP) => [->//|eq]; apply/val_inj/fsfunP. Qed.
14311436

14321437
Definition onecm : cmonom I := CMonom [fsfun of _ => 0%N].
@@ -1472,12 +1477,16 @@ move: m1 m2; have gen m1 m2 : mulcm m1 m2 = onecm -> m1 = onecm.
14721477
by move=> m1 m2 h; split; move: h; last rewrite mulcmC; apply/gen.
14731478
Qed.
14741479

1480+
#[hnf]
14751481
HB.instance Definition _ := Choice_isMonomialDef.Build (cmonom I)
14761482
mulcmA mul0cm mulcm0 mulcm_eq0.
1483+
#[hnf]
14771484
HB.instance Definition _ := MonomialDef_isConomialDef.Build (cmonom I) mulcmC.
14781485

14791486
End CmonomCanonicals.
14801487

1488+
HB.instance Definition _ (I : countType) := [Countable of cmonom I by <:].
1489+
14811490
(* -------------------------------------------------------------------- *)
14821491
Definition mdeg {I : choiceType} (m : cmonom I) :=
14831492
(\sum_(k <- finsupp m) m k)%N.
@@ -1672,6 +1681,8 @@ Canonical fmonom_unlockable k := [unlockable fun fmonom_of_seq k].
16721681

16731682
End FmonomDef.
16741683

1684+
Bind Scope monom_scope with fmonom.
1685+
16751686
Notation "{ 'fmonom' I }" := (fmonom I) : type_scope.
16761687

16771688
Local Notation mkfmonom s := (fmonom_of_seq fmonom_key s).
@@ -1728,6 +1739,8 @@ HB.instance Definition _ := Choice_isMonomialDef.Build (fmonom I)
17281739

17291740
End FmonomCanonicals.
17301741

1742+
HB.instance Definition _ (I : countType) := [Countable of fmonom I by <:].
1743+
17311744
(* -------------------------------------------------------------------- *)
17321745
Definition fdeg (I : choiceType) (m : fmonom I) := size m.
17331746

0 commit comments

Comments
 (0)