Skip to content

Instantly share code, notes, and snippets.

@gaxiiiiiiiiiiii
Created April 30, 2023 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaxiiiiiiiiiiii/711d0757d13bea1a7f08a25d361a8bb5 to your computer and use it in GitHub Desktop.
Save gaxiiiiiiiiiiii/711d0757d13bea1a7f08a25d361a8bb5 to your computer and use it in GitHub Desktop.
From mathcomp Require Export fintype.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Module NonEmptyFintype.
Section Def.
Variable T : finType.
Record mixin_of := Mixin {
default : T;
}.
Structure class_of (T : finType):= Class {
base : Finite.class_of T;
mixin : mixin_of
}.
Structure type := Pack {
sort : finType ;
class_ : class_of sort
}.
End Def.
Section NonEmptyFintype_of.
Variable T : finType.
Variable x : T.
Definition nonEmptyFinType_of : type T :=
{|
sort := T;
class_ := {|
base := Finite.class T;
mixin := {| default := x |}
|};
|}.
End NonEmptyFintype_of.
Module Exports.
Coercion base : class_of >-> Finite.class_of.
Coercion sort : type >-> finType.
Notation nonEmptyFintype := NonEmptyFintype.type.
Notation default T := (default (mixin (class_ T))).
Notation nonEmptyFinType_of := NonEmptyFintype.nonEmptyFinType_of.
End Exports.
End NonEmptyFintype.
Export NonEmptyFintype.Exports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment