summaryrefslogtreecommitdiff
path: root/theories/Setoids/Setoid.v
blob: 8afaedd643cd60ea34a48b219b47f7242260b5d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010     *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(*i $Id: Setoid.v 13323 2010-07-24 15:57:30Z herbelin $: i*)

Require Export Coq.Classes.SetoidTactics.

Export Morphisms.ProperNotations.

(** For backward compatibility *)

Definition Setoid_Theory := @Equivalence.
Definition Build_Setoid_Theory := @Build_Equivalence.

Definition Seq_refl A Aeq (s : Setoid_Theory A Aeq) : forall x:A, Aeq x x.
  unfold Setoid_Theory in s. intros ; reflexivity.
Defined.

Definition Seq_sym A Aeq (s : Setoid_Theory A Aeq) : forall x y:A, Aeq x y -> Aeq y x.
  unfold Setoid_Theory in s. intros ; symmetry ; assumption.
Defined.

Definition Seq_trans A Aeq (s : Setoid_Theory A Aeq) : forall x y z:A, Aeq x y -> Aeq y z -> Aeq x z.
  unfold Setoid_Theory in s. intros ; transitivity y ; assumption.
Defined.

(** Some tactics for manipulating Setoid Theory not officially
    declared as Setoid. *)

Ltac trans_st x :=
  idtac "trans_st on Setoid_Theory is OBSOLETE";
  idtac "use transitivity on Equivalence instead";
  match goal with
    | H : Setoid_Theory _ ?eqA |- ?eqA _ _ =>
      apply (Seq_trans _ _ H) with x; auto
  end.

Ltac sym_st :=
  idtac "sym_st on Setoid_Theory is OBSOLETE";
  idtac "use symmetry on Equivalence instead";
  match goal with
    | H : Setoid_Theory _ ?eqA |- ?eqA _ _ =>
      apply (Seq_sym _ _ H); auto
  end.

Ltac refl_st :=
  idtac "refl_st on Setoid_Theory is OBSOLETE";
  idtac "use reflexivity on Equivalence instead";
  match goal with
    | H : Setoid_Theory _ ?eqA |- ?eqA _ _ =>
      apply (Seq_refl _ _ H); auto
  end.

Definition gen_st : forall A : Set, Setoid_Theory _ (@eq A).
Proof.
  constructor; congruence.
Qed.