Skip to content

Commit 2506a86

Browse files
authored
Merge pull request #576 from proux01/rocq21611
Adapt to rocq-prover/rocq#21611
2 parents 6514c36 + a12d7cc commit 2506a86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+151
-151
lines changed

HB/common/phant-abbreviation.elpi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,14 @@ build-type-pattern.aux _ _ _ :- coq.error "HB: wrong carrier type".
225225
% [find s_0 | t ~ s_0]
226226
% [find c_0 | s_0 ~ SK q_1 .. q_l t c_0]
227227
% [find m'_{i_0_0}, .., m'_{i_0_n0} | c_0 ~ CK m'_{i_0_0} .. m'_{i_0_n0}]
228-
% fun of hb.unify m_{i_0_0} m'_{i_0_0} & ... & hb.unify m_{i_0_n0} m'_{i_0_n0} =>
228+
% fun & hb.unify m_{i_0_0} m'_{i_0_0} & ... & hb.unify m_{i_0_n0} m'_{i_0_n0} =>
229229
% ...
230230
% fun q'_1 .. q'_l' =>
231231
% [find t | T ~ t]
232232
% [find s_k | t ~ s_k]
233233
% [find c_k | s_k ~ SK q'_1 .. q'_l' y c_k]
234234
% [find m'_{i_k_0}, .., m'_{i_k_nk} | c_0 ~ CK m'_{i_k_0} .. m'_{i_k_nk}]
235-
% fun of hb.unify m_{i_0_0} m'_{i_0_0} & ... & hb.unify m_{i_k_nk} m'_{i_k_nk} =>
235+
% fun & hb.unify m_{i_0_0} m'_{i_0_0} & ... & hb.unify m_{i_k_nk} m'_{i_k_nk} =>
236236
% F p_1 ... p_k T m_i0_j0 .. m_il_jl}}
237237
func mk-phant-term.mixins term, term, classname, phant-term,
238238
list term, name, term, (term -> list (w-args mixinname)) -> phant-term.

HB/structures.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ Elpi Export HB.graph.
439439
with requirements [Factory1] .. [FactoryN]:
440440
441441
[[
442-
HB.mixin Record MixinName T of Factory1 T & … & FactoryN T := {
442+
HB.mixin Record MixinName T & Factory1 T & … & FactoryN T := {
443443
op : T -> …
444444
445445
property : forall x : T, op …
@@ -451,7 +451,7 @@ HB.mixin Record MixinName T of Factory1 T & … & FactoryN T := {
451451
- [MixinName T] abbreviation for the type of the (degenerate) factory
452452
- [MixinName.Build T] abbreviation for the constructor of the factory
453453
454-
Note: [T of f1 T & … & fN T] is ssreflect syntax for [T (_ : f1 T) … (_ : fN T)]
454+
Note: [T & f1 T & … & fN T] is syntactic sugar for [T (_ : f1 T) … (_ : fN T)]
455455
456456
Supported attributes:
457457
- [#[primitive]] experimental attribute to make the mixin/factory primitive,
@@ -500,7 +500,7 @@ actions N :-
500500
main [indt-decl D] :- record-decl->id D N, with-attributes (actions N).
501501

502502
main _ :-
503-
coq.error "Usage: HB.mixin Record <MixinName> T of F A & … := { … }.".
503+
coq.error "Usage: HB.mixin Record <MixinName> T & F A & … := { … }.".
504504
}}.
505505
Elpi Typecheck.
506506
Elpi Export HB.mixin.
@@ -857,7 +857,7 @@ main [indt-decl D] :- record-decl->id D N, with-attributes (actions N).
857857
main [const-decl N _ _] :- with-attributes (actions N).
858858

859859
main _ :-
860-
coq.error "Usage: HB.factory Record <FactoryName> T of F A & … := { … }.\nUsage: HB.factory Definition <FactoryName> T of F A := t.".
860+
coq.error "Usage: HB.factory Record <FactoryName> T & F A & … := { … }.\nUsage: HB.factory Definition <FactoryName> T of F A := t.".
861861
}}.
862862
Elpi Typecheck.
863863
Elpi Export HB.factory.
@@ -1121,7 +1121,7 @@ This command populates the current section with canonical instances.
11211121
11221122
Syntax:
11231123
[[
1124-
HB.declare Context (p1 : P1) ... (pn : Pn) (t : T) of F0 ... Fk.
1124+
HB.declare Context (p1 : P1) ... (pn : Pn) (t : T) & F0 & ... & Fk.
11251125
]]
11261126
Effect:
11271127
[[

examples/GReTA_talk/V2.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ HB.mixin Record is_semigroup (S : Type) := {
88
HB.structure Definition SemiGroup :=
99
{ S of is_semigroup S }.
1010

11-
HB.mixin Record semigroup_is_monoid M of is_semigroup M := {
11+
HB.mixin Record semigroup_is_monoid M & is_semigroup M := {
1212
zero : M;
1313
add0r : forall x, add zero x = x;
1414
addr0 : forall x, add x zero = x;

examples/GReTA_talk/V3.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ HB.mixin Record is_semigroup (S : Type) := {
88
HB.structure Definition SemiGroup :=
99
{ S & is_semigroup S }.
1010

11-
HB.mixin Record semigroup_is_monoid M of is_semigroup M := {
11+
HB.mixin Record semigroup_is_monoid M & is_semigroup M := {
1212
zero : M;
1313
add0r : forall x, add zero x = x;
1414
addr0 : forall x, add x zero = x;

examples/GReTA_talk/V4.v

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ HB.mixin Record is_semigroup (S : Type) := {
77
}.
88
HB.structure Definition SemiGroup := { S & is_semigroup S }.
99

10-
HB.mixin Record semigroup_is_monoid M of is_semigroup M := {
10+
HB.mixin Record semigroup_is_monoid M & is_semigroup M := {
1111
zero : M;
1212
add0r : forall x, add zero x = x;
1313
addr0 : forall x, add x zero = x;
@@ -20,14 +20,14 @@ HB.factory Record is_monoid M := {
2020
add0r : forall x, add zero x = x;
2121
addr0 : forall x, add x zero = x;
2222
}.
23-
HB.builders Context (M : Type) of is_monoid M.
23+
HB.builders Context (M : Type) & is_monoid M.
2424
HB.instance Definition _ := is_semigroup.Build M add addrA.
2525
HB.instance Definition _ := semigroup_is_monoid.Build M zero add0r addr0.
2626
HB.end.
2727

2828
HB.structure Definition Monoid := { M & is_monoid M }.
2929

30-
HB.mixin Record monoid_is_group G of is_monoid G := {
30+
HB.mixin Record monoid_is_group G & is_monoid G := {
3131
opp : G -> G;
3232
subrr : forall x, add x (opp x) = zero;
3333
addNr : forall x, add (opp x) x = zero;
@@ -43,7 +43,7 @@ HB.factory Record is_group G := {
4343
subrr : forall x, add x (opp x) = zero;
4444
addNr : forall x, add (opp x) x = zero;
4545
}.
46-
HB.builders Context G of is_group G.
46+
HB.builders Context G & is_group G.
4747
Let addr0 : forall x, add x zero = x.
4848
Proof. by move=> x; rewrite -(addNr x) addrA subrr add0r. Qed.
4949
HB.instance Definition _ := is_monoid.Build G zero add addrA add0r addr0.
@@ -53,4 +53,4 @@ HB.end.
5353
HB.instance Definition Z_is_group : is_group Z :=
5454
is_group.Build Z 0%Z Z.add Z.opp
5555
Z.add_assoc Z.add_0_l (* Z.add_0_r (*spurious *) *)
56-
Z.sub_diag Z.add_opp_diag_l.
56+
Z.sub_diag Z.add_opp_diag_l.

examples/cat/cat.v

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Notation "a ~>_ C b" := (@hom C a b)
4040
(at level 99, C at level 0, only parsing) : cat_scope.
4141

4242
(* precategories are quivers + id and comp *)
43-
HB.mixin Record Quiver_IsPreCat C of Quiver C := {
43+
HB.mixin Record Quiver_IsPreCat C & Quiver C := {
4444
idmap : forall (a : C), a ~> a;
4545
comp : forall (a b c : C), (a ~> b) -> (b ~> c) -> (a ~> c);
4646
}.
@@ -50,7 +50,7 @@ HB.factory Record IsPreCat C := {
5050
idmap : forall (a : C), hom a a;
5151
comp : forall (a b c : C), hom a b -> hom b c -> hom a c;
5252
}.
53-
HB.builders Context C of IsPreCat C.
53+
HB.builders Context C & IsPreCat C.
5454
HB.instance Definition _ := IsQuiver.Build C hom.
5555
HB.instance Definition _ := Quiver_IsPreCat.Build C idmap comp.
5656
HB.end.
@@ -70,7 +70,7 @@ Notation "f \; g" := (comp f g) : cat_scope.
7070
Notation "\idmap_ a" := (@idmap _ a) (only parsing, at level 0) : cat_scope.
7171

7272
(* categories are precategories + laws *)
73-
HB.mixin Record PreCat_IsCat C of PreCat C := {
73+
HB.mixin Record PreCat_IsCat C & PreCat C := {
7474
comp1o : forall (a b : C) (f : a ~> b), idmap \; f = f;
7575
compo1 : forall (a b : C) (f : a ~> b), f \; idmap = f;
7676
compoA : forall (a b c d : C) (f : a ~> b) (g : b ~> c) (h : c ~> d),
@@ -144,7 +144,7 @@ Qed.
144144

145145
(* a functor is a prefunctor + laws for id and comp *)
146146
HB.mixin Record PreFunctor_IsFunctor (C D : precat) (F : C -> D)
147-
of @PreFunctor C D F := {
147+
& @PreFunctor C D F := {
148148
F1 : forall (a : C), F <$> \idmap_a = idmap;
149149
Fcomp : forall (a b c : C) (f : a ~> b) (g : b ~> c),
150150
F <$> (f \; g) = F <$> f \; F <$> g;
@@ -227,7 +227,7 @@ HB.instance Definition _ := cat_cat.
227227
Check (cat : cat).
228228

229229
(* concrete categories *)
230-
HB.mixin Record Quiver_IsPreConcrete T of Quiver T := {
230+
HB.mixin Record Quiver_IsPreConcrete T & Quiver T := {
231231
concrete : T -> U;
232232
concrete_fun : forall (a b : T), (a ~> b) -> concrete a -> concrete b;
233233
}.
@@ -238,7 +238,7 @@ HB.structure Definition PreConcreteQuiver : Set :=
238238
Set Universe Checking.
239239
Coercion concrete : PreConcreteQuiver.sort >-> Sortclass.
240240

241-
HB.mixin Record PreConcrete_IsConcrete T of PreConcreteQuiver T := {
241+
HB.mixin Record PreConcrete_IsConcrete T & PreConcreteQuiver T := {
242242
concrete_fun_inj : forall (a b : T), injective (concrete_fun a b)
243243
}.
244244
Unset Universe Checking.
@@ -250,7 +250,7 @@ Set Universe Checking.
250250
HB.instance Definition _ (C : ConcreteQuiver.type) :=
251251
IsPreFunctor.Build _ _ (concrete : C -> U) concrete_fun.
252252

253-
HB.mixin Record PreCat_IsConcrete T of ConcreteQuiver T & PreCat T := {
253+
HB.mixin Record PreCat_IsConcrete T & ConcreteQuiver T & PreCat T := {
254254
concrete1 : forall (a : T), concrete <$> \idmap_a = idfun;
255255
concrete_comp : forall (a b c : T) (f : a ~> b) (g : b ~> c),
256256
concrete <$> (f \; g) = ((concrete <$> g) \o (concrete <$> f))%function;
@@ -308,7 +308,7 @@ HB.instance Definition _ := PreCat_IsConcrete.Build cat
308308
(fun=> erefl) (fun _ _ _ _ _ => erefl).
309309

310310
(* constant functor *)
311-
Definition cst (C D : quiver) (c : C) := fun of D => c.
311+
Definition cst (C D : quiver) (c : C) := fun & D => c.
312312
Arguments cst {C} D c.
313313
HB.instance Definition _ {C D : precat} (c : C) :=
314314
IsPreFunctor.Build D C (cst D c) (fun _ _ _ => idmap).
@@ -574,7 +574,7 @@ Lemma delta_functor {C D : cat} : PreFunctor_IsFunctor _ _ (delta C D).
574574
Proof. by constructor=> [a|a b c f g]; exact/natP. Qed.
575575
HB.instance Definition _ C D := @delta_functor C D.
576576

577-
HB.mixin Record IsMonad (C : precat) (M : C -> C) of @PreFunctor C C M := {
577+
HB.mixin Record IsMonad (C : precat) (M : C -> C) & @PreFunctor C C M := {
578578
unit : idfun ~~> M;
579579
join : (M \o M)%function ~~> M;
580580
bind : forall (a b : C), (a ~> M b) -> (M a ~> M b);
@@ -591,19 +591,19 @@ HB.structure Definition PreMonad (C : precat) :=
591591
HB.structure Definition Monad (C : precat) :=
592592
{M of @Functor C C M & IsMonad C M}.
593593

594-
HB.factory Record IsJoinMonad (C : precat) (M : C -> C) of @PreFunctor C C M := {
594+
HB.factory Record IsJoinMonad (C : precat) (M : C -> C) & @PreFunctor C C M := {
595595
unit : idfun ~~> M;
596596
join : (M \o M)%function ~~> M;
597597
unit_join : forall a, (M <$> unit a) \; join _ = idmap;
598598
join_unit : forall a, join _ \; (M <$> unit a) = idmap;
599599
join_square : forall a, M <$> join a \; join _ = join _ \; join _
600600
}.
601-
HB.builders Context C M of IsJoinMonad C M.
601+
HB.builders Context C M & IsJoinMonad C M.
602602
HB.instance Definition _ := IsMonad.Build C M
603603
(fun a b f => erefl) unit_join join_unit join_square.
604604
HB.end.
605605

606-
HB.mixin Record IsCoMonad (C : precat) (M : C -> C) of @IsPreFunctor C C M := {
606+
HB.mixin Record IsCoMonad (C : precat) (M : C -> C) & @IsPreFunctor C C M := {
607607
counit : M ~~> idfun;
608608
cojoin : M ~~> (M \o M)%function;
609609
cobind : forall (a b : C), (M a ~> b) -> (M a ~> M b);
@@ -619,14 +619,14 @@ HB.structure Definition PreCoMonad (C : precat) :=
619619
HB.structure Definition CoMonad (C : precat) :=
620620
{M of @Functor C C M & IsCoMonad C M}.
621621

622-
HB.factory Record IsJoinCoMonad (C : precat) (M : C -> C) of @IsPreFunctor C C M := {
622+
HB.factory Record IsJoinCoMonad (C : precat) (M : C -> C) & @IsPreFunctor C C M := {
623623
counit : M ~~> idfun;
624624
cojoin : M ~~> (M \o M)%function;
625625
unit_cojoin : forall a, (M <$> counit a) \; cojoin _ = idmap;
626626
join_counit : forall a, cojoin _ \; (M <$> counit a) = idmap;
627627
cojoin_square : forall a, cojoin _ \; M <$> cojoin a = cojoin _ \; cojoin _
628628
}.
629-
HB.builders Context C M of IsJoinCoMonad C M.
629+
HB.builders Context C M & IsJoinCoMonad C M.
630630
HB.instance Definition _ := IsCoMonad.Build C M
631631
(fun a b f => erefl) unit_cojoin join_counit cojoin_square.
632632
HB.end.
@@ -822,7 +822,7 @@ Definition feqsym {C : precat} {a b : C} : a = b -> b ~> a.
822822
Proof. by move<-; exact idmap. Defined.
823823

824824
HB.mixin Record IsLeftAdjointOf (C D : cat) (R : D ~> C) L
825-
of @Functor C D L := {
825+
& @Functor C D L := {
826826
Lphi : forall c d, (L c ~> d) -> (c ~> R d);
827827
Lpsi : forall c d, (c ~> R d) -> (L c ~> d);
828828
(* there should be a monad and comonad structure wrappers instead *)
@@ -861,7 +861,7 @@ Arguments Lcounit {C D R s}.
861861
(* End LeftAdjointOf_Theory. *)
862862

863863
HB.mixin Record IsRightAdjoint (D C : cat) (R : D -> C)
864-
of @Functor D C R := {
864+
& @Functor D C R := {
865865
(* we should have a wrapper instead *)
866866
left_adjoint : C ~> D;
867867
LLphi : forall c d, (left_adjoint c ~> d) -> (c ~> R d);
@@ -886,7 +886,7 @@ Arguments LLpsi {D C s} {c d}.
886886
Arguments LLunit {D C s}.
887887
Arguments LLcounit {D C s}.
888888

889-
HB.mixin Record PreCat_IsMonoidal C of PreCat C := {
889+
HB.mixin Record PreCat_IsMonoidal C & PreCat C := {
890890
onec : C;
891891
prod : (C * C)%type ~>_precat C;
892892
}.
@@ -906,7 +906,7 @@ Definition hom_cast {C : quiver} {a a' : C} (eqa : a = a')
906906
(a ~> b) -> (a' ~> b').
907907
Proof. now elim: _ / eqa; elim: _ / eqb. Defined.
908908

909-
HB.mixin Record PreFunctor_IsMonoidal (C D : premonoidal) F of
909+
HB.mixin Record PreFunctor_IsMonoidal (C D : premonoidal) F &
910910
@PreFunctor C D F := {
911911
fun_one : F 1 = 1;
912912
fun_prod : forall (x y : C), F (x * y) = F x * F y;
@@ -949,7 +949,7 @@ HB.instance Definition _ {C : premonoidal} :=
949949
IsPreFunctor.Build C C prod1l
950950
(fun (a b : C) (f : a ~> b) => f <*> \idmap_1).
951951

952-
HB.mixin Record PreMonoidal_IsMonoidal C of PreMonoidal C := {
952+
HB.mixin Record PreMonoidal_IsMonoidal C & PreMonoidal C := {
953953
prodA : prod3l ~~> prod3r;
954954
prod1c : prod1r ~~> idfun;
955955
prodc1 : prod1l ~~> idfun;
@@ -1070,7 +1070,7 @@ HB.mixin Record IsIdeal (R : ring) (I : R -> Prop) := {
10701070
}.
10711071
HB.structure Definition Ideal (R : ring) := { I of IsIdeal R I }.
10721072

1073-
HB.mixin Record Ideal_IsPrime (R : ring) (I : R -> Prop) of IsIdeal R I := {
1073+
HB.mixin Record Ideal_IsPrime (R : ring) (I : R -> Prop) & IsIdeal R I := {
10741074
ideal_prime : forall x y : R, I (x * y)%A -> I x \/ I y
10751075
}.
10761076
#[short(type="spectrum")]

examples/demo3/hierarchy_0.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ HB.mixin Record MulMonoid_of_Type A := {
1010
}.
1111
HB.structure Definition MulMonoid := { A of MulMonoid_of_Type A }.
1212

13-
HB.mixin Record Ring_of_MulMonoid A of MulMonoid A := {
13+
HB.mixin Record Ring_of_MulMonoid A & MulMonoid A := {
1414
zero : A;
1515
add : A -> A -> A;
1616
addrA : associative add;

examples/demo3/hierarchy_1.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ HB.mixin Record AddMonoid_of_Type A := {
1919
}.
2020
HB.structure Definition AddMonoid := { A of AddMonoid_of_Type A }.
2121

22-
HB.mixin Record Ring_of_AddMulMonoid A of MulMonoid A & AddMonoid A := {
22+
HB.mixin Record Ring_of_AddMulMonoid A & MulMonoid A & AddMonoid A := {
2323
opp : A -> A;
2424
addrC : commutative (add : A -> A -> A);
2525
addNr : left_inverse zero opp add;
@@ -28,7 +28,7 @@ HB.mixin Record Ring_of_AddMulMonoid A of MulMonoid A & AddMonoid A := {
2828
}.
2929
HB.structure Definition Ring := { A of MulMonoid A & AddMonoid A & Ring_of_AddMulMonoid A }.
3030

31-
HB.factory Record Ring_of_MulMonoid A of MulMonoid A := {
31+
HB.factory Record Ring_of_MulMonoid A & MulMonoid A := {
3232
zero : A;
3333
add : A -> A -> A;
3434
addrA : associative add;

examples/demo3/hierarchy_2.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ HB.mixin Record AddMonoid_of_Type A := {
1919
}.
2020
HB.structure Definition AddMonoid := { A of AddMonoid_of_Type A }.
2121

22-
HB.mixin Record AbGroup_of_AddMonoid A of AddMonoid A := {
22+
HB.mixin Record AbGroup_of_AddMonoid A & AddMonoid A := {
2323
opp : A -> A;
2424
addrC : commutative (add : A -> A -> A);
2525
addNr : left_inverse zero opp add;
2626
}.
2727
HB.structure Definition AbGroup := { A of AddMonoid A & AbGroup_of_AddMonoid A }.
2828

29-
HB.mixin Record Ring_of_AbGroupMulMonoid A of MulMonoid A & AbGroup A := {
29+
HB.mixin Record Ring_of_AbGroupMulMonoid A & MulMonoid A & AbGroup A := {
3030
mulrDl : left_distributive mul (add : A -> A -> A);
3131
mulrDr : right_distributive mul (add : A -> A -> A);
3232
}.
3333
HB.structure Definition Ring := { A of MulMonoid A & AbGroup A & Ring_of_AbGroupMulMonoid A }.
3434

35-
HB.factory Record Ring_of_AddMulMonoid A of MulMonoid A & AddMonoid A := {
35+
HB.factory Record Ring_of_AddMulMonoid A & MulMonoid A & AddMonoid A := {
3636
opp : A -> A;
3737
addrC : commutative (add : A -> A -> A);
3838
addNr : left_inverse zero opp add;
@@ -52,7 +52,7 @@ HB.builders Context A (a : Ring_of_AddMulMonoid A).
5252

5353
HB.end.
5454

55-
HB.factory Record Ring_of_MulMonoid A of MulMonoid A := {
55+
HB.factory Record Ring_of_MulMonoid A & MulMonoid A := {
5656
zero : A;
5757
add : A -> A -> A;
5858
addrA : associative add;

examples/demo4/hierarchy_0.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Check (refl_equal _ : @inhab _ _ = 7).
1616
HB.instance Definition list_m1 A := m1.Build (option A) (list nat) (cons 7 nil) None.
1717
Check (refl_equal _ : @inhab _ _ = (cons 7 nil)).
1818

19-
HB.mixin Record m2 (T : Type) (A : Type) of m1 T A := {
19+
HB.mixin Record m2 (T : Type) (A : Type) & m1 T A := {
2020
inj : T -> A;
2121
}.
2222

@@ -25,4 +25,4 @@ HB.structure Definition s2 T :=
2525

2626
Check fun X : s2.type nat => inhab : X.
2727
Check fun X : s2.type nat => inj : nat -> X.
28-
About s2_to_s1.
28+
About s2_to_s1.

0 commit comments

Comments
 (0)