Skip to content
Snippets Groups Projects
Commit dff135cd authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Merge branch 'ralf/fin_to_set' into 'master'

add a function to obtain a set with all elements of a finite type

See merge request iris/stdpp!196
parents ff44fd43 fda4dbb9
No related branches found
No related tags found
1 merge request!196add a function to obtain a set with all elements of a finite type
Pipeline #36571 failed
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
importantly, it implements some tactics to automatically solve goals involving importantly, it implements some tactics to automatically solve goals involving
sets. *) sets. *)
From stdpp Require Export orders list list_numbers. From stdpp Require Export orders list list_numbers.
From stdpp Require Import options. From stdpp Require Import options finite.
(* FIXME: This file needs a 'Proof Using' hint, but they need to be set (* FIXME: This file needs a 'Proof Using' hint, but they need to be set
locally (or things moved out of sections) as no default works well enough. *) locally (or things moved out of sections) as no default works well enough. *)
...@@ -873,6 +873,22 @@ Section option_and_list_to_set. ...@@ -873,6 +873,22 @@ Section option_and_list_to_set.
Proof. induction 1; set_solver. Qed. Proof. induction 1; set_solver. Qed.
End option_and_list_to_set. End option_and_list_to_set.
(** * Finite types to sets. *)
Definition fin_to_set (A : Type) `{SemiSet A C, Finite A} : C :=
list_to_set (enum A).
Section fin_to_set.
Context `{SemiSet A C, Finite A}.
Implicit Types a : A.
Lemma elem_of_fin_to_set a : a fin_to_set A.
Proof. apply elem_of_list_to_set, elem_of_enum. Qed.
Global Instance set_unfold_fin_to_set a :
SetUnfoldElemOf a (fin_to_set A) True.
Proof. constructor. split; auto using elem_of_fin_to_set. Qed.
End fin_to_set.
(** * Guard *) (** * Guard *)
Global Instance set_guard `{MonadSet M} : MGuard M := Global Instance set_guard `{MonadSet M} : MGuard M :=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment