diff options
| author | Anton Trunov | 2019-05-28 22:57:38 +0300 |
|---|---|---|
| committer | Anton Trunov | 2019-05-28 23:56:19 +0300 |
| commit | eac1d28204c93f082771dedb90fc5a1edec6e6f8 (patch) | |
| tree | 1d3709a7e13e1db2508253213ee690af1e222d2c /mathcomp/ssreflect | |
| parent | 748d716efb2f2f75946c8386e441ce1789806a39 (diff) | |
Add eqsP view to destruct not only x == y, but also y == x
Diffstat (limited to 'mathcomp/ssreflect')
| -rw-r--r-- | mathcomp/ssreflect/eqtype.v | 9 | ||||
| -rw-r--r-- | mathcomp/ssreflect/seq.v | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/mathcomp/ssreflect/eqtype.v b/mathcomp/ssreflect/eqtype.v index 3fbc110..895a86e 100644 --- a/mathcomp/ssreflect/eqtype.v +++ b/mathcomp/ssreflect/eqtype.v @@ -196,6 +196,15 @@ Proof. exact/eqP/eqP. Qed. Hint Resolve eq_refl eq_sym : core. +Variant eq_xor_neq_sym (T : eqType) (x y : T) : bool -> bool -> Set := + | EqNotNeqSym of x = y : eq_xor_neq_sym x y true true + | NeqNotEqSym of x <> y : eq_xor_neq_sym x y false false. + +Lemma eqsP (T : eqType) (x y : T) : eq_xor_neq_sym x y (y == x) (x == y). +Proof. by rewrite eq_sym; case: eqP; constructor. Qed. + +Arguments eqsP {T x y}. + Section Contrapositives. Variables (T1 T2 : eqType). diff --git a/mathcomp/ssreflect/seq.v b/mathcomp/ssreflect/seq.v index 00e0a27..516dc95 100644 --- a/mathcomp/ssreflect/seq.v +++ b/mathcomp/ssreflect/seq.v @@ -1191,7 +1191,7 @@ Proof. by rewrite -has_pred1 has_count -eqn0Ngt; apply: eqP. Qed. Lemma count_uniq_mem s x : uniq s -> count_mem x s = (x \in s). Proof. elim: s => //= y s IHs /andP[/negbTE s'y /IHs-> {IHs}]. -by rewrite in_cons eq_sym; case: eqP => // ->; rewrite s'y. +by rewrite in_cons; case: eqsP => // <-; rewrite s'y. Qed. Lemma filter_pred1_uniq s x : uniq s -> x \in s -> filter (pred1 x) s = [:: x]. @@ -1303,7 +1303,7 @@ Lemma rot_to s x : x \in s -> rot_to_spec s x. Proof. move=> s_x; pose i := index x s; exists i (drop i.+1 s ++ take i s). rewrite -cat_cons {}/i; congr cat; elim: s s_x => //= y s IHs. -by rewrite eq_sym in_cons; case: eqP => // -> _; rewrite drop0. +by rewrite in_cons; case: eqsP => // -> _; rewrite drop0. Qed. End EqSeq. @@ -2167,7 +2167,7 @@ Lemma nth_index_map s x0 x : {in s &, injective f} -> x \in s -> nth x0 s (index (f x) (map f s)) = x. Proof. elim: s => //= y s IHs inj_f s_x; rewrite (inj_in_eq inj_f) ?mem_head //. -move: s_x; rewrite inE eq_sym; case: eqP => [-> | _] //=; apply: IHs. +move: s_x; rewrite inE; case: eqsP => [-> | _] //=; apply: IHs. by apply: sub_in2 inj_f => z; apply: predU1r. Qed. |
