Skip to content

Commit 4550b8c

Browse files
authored
fixes #203 (#208)
* fixes #203
1 parent 07c0dfa commit 4550b8c

11 files changed

Lines changed: 46 additions & 62 deletions

File tree

.github/workflows/docker-action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ jobs:
1717
strategy:
1818
matrix:
1919
image:
20-
- 'mathcomp/mathcomp:2.4.0-coq-8.20'
2120
- 'mathcomp/mathcomp:2.4.0-rocq-prover-9.0'
21+
- 'mathcomp/mathcomp:2.4.0-rocq-prover-9.1'
22+
- 'mathcomp/mathcomp:2.5.0-rocq-prover-9.0'
23+
- 'mathcomp/mathcomp:2.5.0-rocq-prover-9.1'
2224
fail-fast: false
2325
steps:
2426
- uses: actions/checkout@v2

coq-infotheo.opam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ build: [
2121
]
2222
install: [make "install"]
2323
depends: [
24-
"coq" { (>= "8.20" & < "9.2~") }
25-
"coq-mathcomp-ssreflect" { (>= "2.4.0" & < "2.6~") }
24+
"coq" { (>= "9.0" & < "9.2~") }
25+
"coq-mathcomp-ssreflect" { (>= "2.4.0" & < "2.7~") }
2626
"coq-mathcomp-fingroup"
2727
"coq-mathcomp-algebra"
2828
"coq-mathcomp-solvable"

ecc_classic/linearcode.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,7 @@ Coercion lcode_coercion (A B : finFieldType) (n : nat) (M : finType) (c : Lcode.
878878
let: Lcode.mk v _ _ _ := c in v.
879879

880880
Section AboutCasts.
881-
882-
Variable R : comRingType.
881+
Variable R : comPzRingType.
883882

884883
Definition cast_cols {rows} {f : nat -> nat -> nat} {P : nat -> nat -> Type}
885884
(HPf : forall k n, P k n -> f k n = n) {k n} (HP : P k n) :

information_theory/channel.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ Reserved Notation "W '``(|' x ')'" (at level 1, x at next level).
5353
Reserved Notation "W '``(' y '|' x ')'" (at level 1, y, x at next level).
5454
Reserved Notation "'`O(' P , W )" (at level 0, P, W at next level,
5555
format "'`O(' P , W )").
56-
Reserved Notation "'`H(' P '`o' W )" (at level 10, P, W at next level,
56+
Reserved Notation "'`H(' P '`o' W )" (at level 0, P, W at next level,
5757
format "'`H(' P '`o' W )").
58-
Reserved Notation "`H( P , W )" (at level 10, P, W at next level,
58+
Reserved Notation "`H( P , W )" (at level 0, P, W at next level,
5959
format "`H( P , W )").
60-
Reserved Notation "`H( W | P )" (at level 10, W, P at next level).
61-
Reserved Notation "`I( P , W )" (at level 50, format "`I( P , W )").
60+
Reserved Notation "`H( W | P )" (at level 0, W, P at next level).
61+
Reserved Notation "`I( P , W )" (at level 0, format "`I( P , W )").
6262

6363
(* TODO: generalize the channel notations to (R:realType) *)
6464
Notation "{ 'fdist' T }" := ((Rdefinitions.R).-fdist T) : fdist_scope.

information_theory/conditional_divergence.v

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ Require Import jfdist_cond.
1212

1313
Reserved Notation "P '|-' V '<<' W" (at level 5, V, W at next level).
1414
Reserved Notation "P '|-' V '<<b' W" (at level 5, V, W at next level).
15-
Reserved Notation "'D(' V '||' W '|' P ')'"
16-
(at level 50, V, W, P at next level).
15+
Reserved Notation "'D(' V '||' W '|' P ')'" (at level 50, V, W, P at next level).
1716

1817
Set Implicit Arguments.
1918
Set SsrOldRewriteGoalsOrder. (* change Set to Unset when porting the file, then remove the line when requiring MathComp >= 2.6 *)

information_theory/entropy.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ Unset Strict Implicit.
3838
Import Prenex Implicits.
3939

4040
Reserved Notation "'`H'" (at level 0).
41-
Reserved Notation "`H( X , Y )" (at level 10, X, Y at next level,
41+
Reserved Notation "`H( X , Y )" (at level 0, X, Y at next level,
4242
format "`H( X , Y )").
43-
Reserved Notation "`H( Y | X )" (at level 10, Y, X at next level).
44-
Reserved Notation "`I( X ; Y )" (at level 50, format "`I( X ; Y )").
43+
Reserved Notation "`H( Y | X )" (at level 0, Y, X at next level).
44+
Reserved Notation "`I( X ; Y )" (at level 0, format "`I( X ; Y )").
4545
Reserved Notation "`H[ Y | X = a ]" (at level 0, Y, X, a at next level,
4646
format "`H[ Y | X = a ]").
4747

lib/derive_ext.v

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
(* Copyright (C) 2025 infotheo authors, license: LGPL-2.1-or-later *)
33
From mathcomp Require Import all_ssreflect ssralg ssrnum interval.
44
From mathcomp Require Import ring lra.
5-
From mathcomp Require Import unstable mathcomp_extra boolp classical_sets functions.
6-
From mathcomp Require Import set_interval.
5+
From mathcomp Require Import unstable mathcomp_extra boolp classical_sets.
6+
From mathcomp Require Import functions set_interval.
77
From mathcomp Require Import reals topology normedtype.
88
From mathcomp Require Import realfun derive exp.
99
Require Import realType_ext ssralg_ext.
@@ -117,7 +117,8 @@ apply: (He `|e'|).
117117
- exact: ltW.
118118
Qed.
119119

120-
Local Notation DQ f v a h := (h^-1 *: (f (h *: v + a) - f a)).
120+
Let DQ (R : numFieldType) (V W : normedModType R) (f : V -> W) v a h :=
121+
(h^-1 *: (f (h *: v + a) - f a)).
121122

122123
Let near_eq_difference_quotient (R : numFieldType) (V W : normedModType R)
123124
(f g : V -> W) (a v : V) :
@@ -144,7 +145,8 @@ have fg0: \forall h \near (0^')%classic, f (h *: v + a) = g (h *: v + a).
144145
rewrite opprD addrCA subrr addr0 normrN !normrZ !normr_id.
145146
rewrite mulrCA ltr_pMl// ?mulr_gt0// ?normr_gt0//.
146147
by rewrite [ltLHS](_ : 1 = 1%:R)// normr_nat ltr_nat.
147-
have:= fg0 => /filterS; apply=> h ->.
148+
have:= fg0 => /filterS.
149+
rewrite /DQ; apply=> h ->.
148150
move: fg.
149151
by rewrite -nbhs_nearE nbhsE=> -[] U [] oU Ua /(_ a Ua) ->.
150152
Qed.

lib/realType_ext.v

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -81,49 +81,50 @@ Lemma prodr_gt0 (R : numDomainType) (A : finType) (F : A -> R) :
8181
(forall a, 0 < F a) -> 0 < \prod_(a : A) F a.
8282
Proof. by move=> F0; elim/big_ind : _ => // x y ? ?; exact: mulr_gt0. Qed.
8383

84+
Notation "p '.~'" := (onem p). (* TODO: remove when dropping support for MCA < 1.15.0 *)
85+
8486
(* PR to mathcomp_extra.v? *)
8587
Section onem.
8688
Variable R : realFieldType.
8789
Implicit Types r s : R.
8890

89-
Lemma onem_le r s : (r <= s) = (`1-s <= `1-r).
91+
Lemma onem_le r s : (r <= s) = (s.~ <= r.~).
9092
Proof.
9193
apply/idP/idP => [|?]; first exact: lerB.
9294
by rewrite -(opprK r) lerNl -(lerD2l 1).
9395
Qed.
9496

95-
Lemma onem_lt r s : (r < s) = (`1-s < `1-r).
97+
Lemma onem_lt r s : (r < s) = (s.~ < r.~).
9698
Proof.
9799
apply/idP/idP => [rs|]; first by rewrite ler_ltB.
98100
by rewrite ltrBrDl addrCA -ltrBrDl subrr subr_lt0.
99101
Qed.
100102

101-
Lemma onemE r : `1-r = 1 - r. Proof. by []. Qed.
103+
Lemma onemE r : r.~ = 1 - r. Proof. by []. Qed.
102104

103-
Lemma onem_div r s : s != 0 -> `1-(r / s) = (s - r) / s.
105+
Lemma onem_div r s : s != 0 -> (r / s).~ = (s - r) / s.
104106
Proof. by rewrite !onemE => q0; rewrite mulrDl mulNr divff. Qed.
105107

106-
Lemma onem_prob r : 0 <= r <= 1 -> 0 <= onem r <= 1.
108+
Lemma onem_prob r : 0 <= r <= 1 -> 0 <= r.~ <= 1.
107109
Proof.
108110
by move=> /andP[r0 r1]; apply/andP; split; [rewrite onem_ge0|rewrite onem_le1].
109111
Qed.
110112

111-
Lemma onem_eq0 r : (`1-r = 0) <-> (r = 1).
113+
Lemma onem_eq0 r : (r.~ = 0) <-> (r = 1).
112114
Proof. by rewrite /onem; split => [/subr0_eq//|->]; rewrite subrr. Qed.
113115

114-
Lemma onem_neq0 (r : R) : (`1-r != 0) <-> (r != 1).
116+
Lemma onem_neq0 (r : R) : (r.~ != 0) <-> (r != 1).
115117
Proof. by split; apply: contra => /eqP/onem_eq0/eqP. Qed.
116118

117-
Lemma onem_eq1 r : `1-r = 1 <-> r = 0. Proof. rewrite onemE; lra. Qed.
119+
Lemma onem_eq1 r : r.~ = 1 <-> r = 0. Proof. rewrite onemE; lra. Qed.
118120

119-
Lemma onem_oprob r : 0 < r < 1 -> 0 < `1-r < 1.
121+
Lemma onem_oprob r : 0 < r < 1 -> 0 < r.~ < 1.
120122
Proof. by move=> /andP [? ?]; apply/andP; rewrite onem_gt0 // onem_lt1. Qed.
121123

122-
Lemma subr_onem r s : r - `1-s = r + s - 1.
124+
Lemma subr_onem r s : r - s.~ = r + s - 1.
123125
Proof. by rewrite /onem opprB addrA. Qed.
124126

125127
End onem.
126-
Notation "p '.~'" := (onem p).
127128

128129
Section about_the_pow_function.
129130

@@ -323,9 +324,6 @@ Global Hint Resolve prob_le1 : core.
323324
#[export] Hint Extern 0 (is_true (@Order.le ring_display _ _ _)) =>
324325
exact/prob_ge0 : core.
325326

326-
Arguments prob0 {R}.
327-
Arguments prob1 {R}.
328-
329327
Lemma prob_invn {R : realType} (m : nat) :
330328
0 <= ((1 + m)%:R^-1 : R) <= 1.
331329
Proof.
@@ -866,19 +864,3 @@ Lemma s_of_gt0_oprob p q : 0 < [s_of (OProb.p p), (OProb.p q)]%:num.
866864
Proof. by rewrite s_of_gt0// oprob_neq0. Qed.
867865

868866
End oprob_lemmas2.
869-
870-
Section i01_prob.
871-
Variable R : realType.
872-
873-
#[deprecated(since="infotheo 0.9.7", note="{prob R} and {i01 R} are identical")]
874-
Definition i01_of_prob (p : {prob R}) : {i01 R} := p.
875-
#[deprecated(since="infotheo 0.9.7", note="{prob R} and {i01 R} are identical")]
876-
Definition prob_of_i01 (p : {i01 R}) : {prob R} := p.
877-
#[deprecated(since="infotheo 0.9.7", note="{prob R} and {i01 R} are identical")]
878-
Lemma i01_of_probK : cancel i01_of_prob prob_of_i01.
879-
Proof. by []. Qed.
880-
#[deprecated(since="infotheo 0.9.7", note="{prob R} and {i01 R} are identical")]
881-
Lemma prob_of_i01K : cancel prob_of_i01 i01_of_prob.
882-
Proof. by []. Qed.
883-
884-
End i01_prob.

probability/convex.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Reserved Notation "\ssum_ ( i < n ) F"
160160
(at level 41, F at level 41, i, n at level 50,
161161
format "'[' \ssum_ ( i < n ) '/ ' F ']'").
162162
Reserved Notation "{ 'affine' T '->' R }"
163-
(at level 36, T, R at next level, format "{ 'affine' T '->' R }").
163+
(at level 0, T, R at next level, format "{ 'affine' T '->' R }").
164164
Reserved Notation "p *: a" (at level 40).
165165

166166
Declare Scope convex_scope.
@@ -2516,7 +2516,7 @@ HB.structure Definition ConvexFunction {R : realType} {d : Order.disp_t} (U : co
25162516
Arguments convex_functionP {R d U V} s.
25172517

25182518
Notation "{ 'convex' T '->' R }" :=
2519-
(ConvexFunction.type T R) (at level 36, T, R at next level,
2519+
(ConvexFunction.type T R) (at level 0, T, R at next level,
25202520
format "{ 'convex' T '->' R }") : convex_scope.
25212521

25222522
Section convex_function_prop'.
@@ -2657,7 +2657,7 @@ HB.structure Definition ConcaveFunction {R : realType} {d : Order.disp_t}
26572657
Arguments concave_functionP {R d U V} s.
26582658

26592659
Notation "{ 'concave' T '->' R }" :=
2660-
(ConvexFunction.type T R) (at level 36, T, R at next level,
2660+
(ConvexFunction.type T R) (at level 0, T, R at next level,
26612661
format "{ 'concave' T '->' R }") : convex_scope.
26622662

26632663
Section concave_function_prop.

probability/necset.v

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ Require Import realType_ext classical_sets_ext fdist fsdist convex.
8080

8181
Declare Scope latt_scope.
8282

83-
Reserved Notation "x %:ne" (at level 0, format "x %:ne").
83+
Reserved Notation "x %:ne" (at level 1, format "x %:ne").
8484
Reserved Notation "x <| p |>: Y" (format "x <| p |>: Y", at level 49).
8585
Reserved Notation "X :<| p |>: Y" (format "X :<| p |>: Y", at level 49).
8686
Reserved Notation "x [+] y" (format "x [+] y", at level 50).
8787
Reserved Notation "'|_|' f" (at level 36, f at level 36, format "|_| f").
8888
Reserved Notation "{ 'necset' T }" (at level 0, format "{ 'necset' T }").
8989
Reserved Notation "{ 'Biglub_morph' T '->' R }"
90-
(at level 36, T, R at next level, format "{ 'Biglub_morph' T '->' R }").
90+
(at level 0, T, R at next level, format "{ 'Biglub_morph' T '->' R }").
9191
Reserved Notation "{ 'Biglub_affine' T '->' R }"
92-
(at level 36, T, R at next level, format "{ 'Biglub_affine' T '->' R }").
92+
(at level 0, T, R at next level, format "{ 'Biglub_affine' T '->' R }").
9393

9494
Set Implicit Arguments.
9595
Set SsrOldRewriteGoalsOrder. (* change Set to Unset when porting the file, then remove the line when requiring MathComp >= 2.6 *)

0 commit comments

Comments
 (0)