| 1 |
From Coq Require Import Setoid. |
| 2 |
From Coq Require Import Morphisms. |
| 3 |
From Coq Require Import List. |
| 4 |
From Coq Require Import SetoidList. |
| 5 |
From Coq Require Import MSetPositive. |
| 6 |
From Coq Require Import MSetFacts. |
| 7 |
Require Import Crypto.Util.Tactics.BreakMatch. |
| 8 |
Require Import Crypto.Util.Tactics.SplitInContext. |
| 9 |
Require Import Crypto.Util.Tactics.SpecializeBy. |
| 10 |
Require Import Crypto.Util.Tactics.DestructHead. |
| 11 |
Require Import Crypto.Util.ListUtil.SetoidList. |
| 12 |
Require Import Crypto.Util.Logic.ExistsEqAnd. |
| 13 |
|
| 14 |
Local Set Implicit Arguments. |
| 15 |
|
| 16 |
Set Implicit Arguments. |
| 17 |
Unset Strict Implicit. |
| 18 |
|
| 19 |
Module PositiveSetFacts. |
| 20 |
Module F := Facts PositiveSet. |
| 21 |
Include F. |
| 22 |
Import PositiveSet. |
| 23 |
|
| 24 |
Global Instance elements_Proper_Equal |
| 25 |
: Proper (Equal ==> Logic.eq) elements | 10. |
| 26 |
Proof. |
| 27 |
intros p1 p2 Hp. |
| 28 |
apply eqlistA_eq_iff. |
| 29 |
eapply SortA_equivlistA_eqlistA; try apply elements_spec2; try exact _. |
| 30 |
cbv [equivlistA]; intro. |
| 31 |
rewrite !elements_spec1. |
| 32 |
apply Hp. |
| 33 |
Qed. |
| 34 |
|
| 35 |
Lemma In_elements_mem_iff {x p} |
| 36 |
: List.In x (elements p) <-> PositiveSet.mem x p = true. |
| 37 |
Proof using Type. |
| 38 |
rewrite elements_b, existsb_exists; cbv [eqb]. |
| 39 |
repeat first [ apply conj |
| 40 |
| progress intros |
| 41 |
| progress destruct_head'_ex |
| 42 |
| progress destruct_head'_and |
| 43 |
| eexists |
| 44 |
| eassumption |
| 45 |
| break_innermost_match_step |
| 46 |
| break_innermost_match_hyps_step |
| 47 |
| congruence ]. |
| 48 |
Qed. |
| 49 |
End PositiveSetFacts. |