Skip to content

Commit 095de44

Browse files
committed
[WIP] replace the infrastructure of mpoly with monalg
1 parent 6527e53 commit 095de44

2 files changed

Lines changed: 611 additions & 1128 deletions

File tree

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).
@@ -1427,7 +1432,7 @@ Proof.
14271432
by rewrite [mkcmonom]unlock.
14281433
Qed.
14291434

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

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

1481+
#[hnf]
14761482
HB.instance Definition _ := Choice_isMonomialDef.Build (cmonom I)
14771483
mulcmA mul0cm mulcm0 mulcm_eq0.
1484+
#[hnf]
14781485
HB.instance Definition _ := MonomialDef_isConomialDef.Build (cmonom I) mulcmC.
14791486

14801487
End CmonomCanonicals.
14811488

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

16741683
End FmonomDef.
16751684

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

16781689
Local Notation mkfmonom s := (fmonom_of_seq fmonom_key s).
@@ -1729,6 +1740,8 @@ HB.instance Definition _ := Choice_isMonomialDef.Build (fmonom I)
17291740

17301741
End FmonomCanonicals.
17311742

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

0 commit comments

Comments
 (0)