Open czhang03 opened 3 years ago
Here is the code from the book
Inductive phantom (T : Type) (p : T) := Phantom. Definition set_of (T : eqType) (_ : phantom Type (Equality.sort T)) := seq T. Notation "{ 'set' T }" := (set_of _ (Phantom Type T)) (at level 0, format "{ ’set’ T }") : type_scope.
Since the book recommends the setting Set Implicit Arguments. which will make many arguments here implicit, therefore this code will not work
Set Implicit Arguments.
Here is a version that write out all the argument explicitly, which will pass the type checking
Inductive phantom (T : Type) (p : T) := Phantom. Definition set_of (T : eqType) (_ : @phantom Type (Equality.sort T)) := seq T. Notation "{ 'set' T }" := (@set_of _ (@Phantom Type T)) (at level 0, format "{ 'set' T }") : type_scope. (*Some examples*) Check {set nat}. Check [:: 1]: {set nat}.
Here is the code from the book
Since the book recommends the setting
Set Implicit Arguments.
which will make many arguments here implicit, therefore this code will not workHere is a version that write out all the argument explicitly, which will pass the type checking