Skip to content

Commit 2dfc068

Browse files
committed
Remove #[infer] attribute
Made useless by reverse coercions in Coq 8.16
1 parent a60dd38 commit 2dfc068

File tree

7 files changed

+5
-72
lines changed

7 files changed

+5
-72
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- **Removed** the `#[primitive_class]` attribute, making it the default.
66
- **New** `HB.saturate` to saturate instances w.r.t. the current hierarchy
7+
- **Removed** the `#[infer]` attribute made obsolete by reverse coercions
8+
since Coq 8.16
79

810
## [1.6.0] - 2023-09-20
911

HB/common/utils.elpi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ with-attributes P :-
2929
att "mathcomp.axiom" string,
3030
att "short.type" string,
3131
att "short.pack" string,
32-
att "infer" attmap,
3332
att "key" string,
3433
att "arg_sort" bool,
3534
att "log" bool,

HB/structure.elpi

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ declare Module BSkel Sort :- std.do! [
5656
if-verbose (coq.say {header} "structure: mixin first class" MixinFirstClass),
5757

5858

59-
private.declare-auto-infer-params-abbrev Structure MLwP LocType PHClauses,
60-
6159
if-verbose (coq.say {header} "declaring clone abbreviation"),
6260
w-params.then MLwP phant.fun-real phant.fun-real
6361
(private.clone-phant-body ClassName SortProjection Structure) PhClone,
@@ -89,11 +87,7 @@ declare Module BSkel Sort :- std.do! [
8987

9088
if (get-option "short.type" ShortType) (
9189
if-verbose (coq.say {header} "short name for type:" ShortType),
92-
if (LocType = loc-abbreviation StrTypeAbbrev) (std.do! [
93-
coq.notation.abbreviation-body StrTypeAbbrev NStrTypeAbbrev StrTypeTm,
94-
@global! => log.coq.notation.add-abbreviation
95-
ShortType NStrTypeAbbrev StrTypeTm ff _
96-
]) (@global! => log.coq.notation.add-abbreviation
90+
(@global! => log.coq.notation.add-abbreviation
9791
ShortType 0 (global Structure) ff _)) true,
9892

9993
coq.mk-app (global Structure) {coq.mk-n-holes {w-params.nparams MLwP}} HB_Instance,
@@ -133,7 +127,7 @@ declare Module BSkel Sort :- std.do! [
133127
std.flatten [
134128
Factories, [ClassAlias], [is-structure Structure],
135129
NewJoins, [class-def CurrentClass], GRDepsClauses,
136-
[gref-deps GRPack MLwP], MixinMems, [StructKeyClause], PHClauses
130+
[gref-deps GRPack MLwP], MixinMems, [StructKeyClause]
137131
]
138132
NewClauses,
139133
acc-clauses current NewClauses,
@@ -449,9 +443,7 @@ synthesize-fields.body _Params T ML (record "axioms_" {{ Type }} "Class" FS) :-
449443

450444
pred mk-record+sort-field i:sort, i:name, i:term, i:(term -> record-decl), o:indt-decl.
451445
pred mk-record+sort-field i:universe, i:name, i:term, i:(term -> record-decl), o:indt-decl.
452-
mk-record+sort-field Sort _ T F (record RecordName (sort Sort) "Pack" (field _ "sort" T F)) :- !, std.do! [
453-
if (get-option "infer" _) (RecordName = "type_") (RecordName = "type")
454-
].
446+
mk-record+sort-field Sort _ T F (record "type" (sort Sort) "Pack" (field _ "sort" T F)).
455447

456448
pred mk-class-field i:classname, i:list term, i:term, i:list (w-args mixinname), o:record-decl.
457449
mk-class-field ClassName Params T _ (field [canonical ff] "class" (app [global ClassName|Args]) _\end-record) :-
@@ -591,27 +583,6 @@ pack-body.aux PL T BuildC PackS Body :- !, std.do! [
591583
mk-app (global PackS) {std.append PL [T, Class]} Body
592584
].
593585

594-
pred declare-auto-infer-params-abbrev i:structure, i:mixins, o:located, o:list prop.
595-
declare-auto-infer-params-abbrev GR MLwP (loc-abbreviation Abbrev) [phant-abbrev GR (const PhC) Abbrev] :-
596-
get-option "infer" Map, !,
597-
Map => mk-infer (global GR) MLwP PhT,
598-
phant.add-abbreviation "type" PhT PhC Abbrev.
599-
declare-auto-infer-params-abbrev GR _ (loc-gref GR) [].
600-
601-
pred mk-infer i:term, i:mixins, o:phant-term.
602-
mk-infer T (w-params.nil _ _ _) PH :- phant.init T PH.
603-
mk-infer T (w-params.cons ID Ty W) R :- (get-option ID "Type" ; get-option ID ""), !,
604-
@pi-parameter ID Ty t\ mk-infer {mk-app T [t]} (W t) (PhT t),
605-
phant.fun-infer-type sortclass {coq.id->name ID} Ty PhT R.
606-
mk-infer T (w-params.cons ID Ty W) R :- (get-option ID "_ -> _"), !,
607-
@pi-parameter ID Ty t\ mk-infer {mk-app T [t]} (W t) (PhT t),
608-
phant.fun-infer-type funclass {coq.id->name ID} Ty PhT R.
609-
mk-infer T (w-params.cons ID Ty W) R :- not (get-option ID _), !,
610-
@pi-parameter ID Ty t\ mk-infer {mk-app T [t]} (W t) (PhT t),
611-
phant.fun-real {coq.id->name ID} Ty PhT R.
612-
mk-infer _ (w-params.cons ID _ _) _ :- get-option ID Infer,
613-
coq.error "Automatic inference of paramter" ID "from" Infer "not supported".
614-
615586
pred mk-infer-key i:class, i:term, i:mixins, i:term, o:phant-term.
616587
mk-infer-key CoeClass K (w-params.nil ID _ _) St PhK :-
617588
@pi-parameter ID St t\ phant.init {mk-app K [t]} (PhKBo t),

_CoqProject.test-suite

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ tests/duplicate_structure.v
6060
tests/instance_params_no_type.v
6161
tests/test_CS_db_filtering.v
6262
tests/subtype.v
63-
tests/infer.v
6463
tests/exports.v
6564
tests/exports2.v
6665
tests/log_impargs_record.v

structures.v

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,6 @@ HB.structure Definition StructureName params :=
581581
Supported attributes:
582582
- [#[mathcomp]] attempts to generate a backward compatibility layer with mathcomp:
583583
trying to infer the right [StructureName.pack],
584-
- [#[infer(variable)]], where [variable : pT] belongs to [params] and is a structure
585-
(e.g. from the hierarchy) with a coercion/canonical projection [pT >-> Sortclass].
586-
It modifies the notation [StructureName.type] so as to accept [variable : Type] instead,
587-
and will try to infer its [pT] by unification (using canonical structure inference),
588-
This is essential in [Lmodule.type R] where [R] should have type [Ring.type]
589-
but any [Type] which is canonically a [Ring.type] is accepted thanks to [#[infer(R)]].
590-
If the carrier of the structure [S] is not a [Type] but rather a function, one has
591-
to write [#[infer(S = "_ -> _")]].
592584
- [#[arg_sort]] defines an alias [StructureName.arg_sort] for [StructureName.sort],
593585
and declares it as the main coercion. [StructureName.sort] is still declared as a coercion
594586
but the only reason is to make sure Coq does not print it.

tests/funclass.v

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ HB.instance Definition x5 :=
5050
Check Monoid.on mult.
5151

5252
HB.mixin Record silly (T1 : Type) (F : Monoid.type T1) (T : Type) := { xx : T }.
53-
#[infer(F = "_ -> _")]
5453
HB.structure Definition wp T (F : Monoid.type T) := { A of silly T F A }.
5554

5655
#[skip="8.11"]

tests/infer.v

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)