aboutsummaryrefslogtreecommitdiff
path: root/contrib/setoid/Setoid_replace.v
blob: d1b6800044b58ec0443eb6f488343b2b934f05a1 (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
64
65
66
67
68
69
70
71
72
73
(***********************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team    *)
(* <O___,, *        INRIA-Rocquencourt  &  LRI-CNRS-Orsay              *)
(*   \VV/  *************************************************************)
(*    //   *      This file is distributed under the terms of the      *)
(*         *       GNU Lesser General Public License Version 2.1       *)
(***********************************************************************)

(* $Id$: *)

Declare ML Module "setoid_replace".

Grammar tactic simple_tactic : ast :=
  setoid_replace [ "Setoid_replace" constrarg($c1) "with" constrarg($c2) ] -> [(Setoid_replace $c1 $c2)]
.

Grammar tactic simple_tactic : ast :=
  setoid_rewriteLR [ "Setoid_rewrite" "->" constrarg($c) ] -> [(Setoid_rewriteLR $c)]
| setoid_rewriteRL [ "Setoid_rewrite" "<-" constrarg($c) ] -> [(Setoid_rewriteRL $c)]
| setoid_rewrite [ "Setoid_rewrite" constrarg($c) ] -> [(Setoid_rewriteLR $c)]
.

Syntax tactic level 0 :
  setoid_replace [<<(Setoid_replace  $c1 $c2)>>] -> [[<hov 0>"Setoid_replace " $c1 [1 1] "with " $c2]]
 | setoid_rewritelr [<<(Setoid_rewriteLR  $c)>>] -> ["Setoid_rewrite " $c]
 | setoid_rewriterl [<<(Setoid_rewriteRL  $c)>>] -> ["Setoid_rewrite <- " $c]
.

Grammar vernac vernac : ast :=
  add_setoid [ "Add" "Setoid" constrarg($a) constrarg($aeq) constrarg($t) "." ] 
    -> [(AddSetoid $a $aeq $t)]
| new_morphism [ "New" "Morphism" identarg($s) constrarg($m) "." ] -> [(NamedNewMorphism $s $m)]
| new_morphism [ "New" "Morphism" identarg($m) "." ] -> [(NewMorphism $m)]
.

Section Setoid.

Variable A : Type.
Variable Aeq : A -> A -> Prop.

Record Setoid_Theory : Prop :=
{ Seq_refl : (x:A) (Aeq x x);
  Seq_sym : (x,y:A) (Aeq x y) -> (Aeq y x);
  Seq_trans : (x,y,z:A) (Aeq x y) -> (Aeq y z) -> (Aeq x z)
}.

End Setoid.

Definition Prop_S : (Setoid_Theory Prop ([x,y:Prop] x<->y)).
Split; Tauto.
Save.

Add Setoid Prop iff Prop_S.

Hint prop_set : setoid := Resolve (Seq_refl Prop iff Prop_S).
Hint prop_set : setoid := Resolve (Seq_sym Prop iff Prop_S).
Hint prop_set : setoid := Resolve (Seq_trans Prop iff Prop_S).

New Morphism or.
Tauto.
Save.

New Morphism and.
Tauto.
Save.

New Morphism not.
Tauto.
Save.

Lemma fleche_ext : (a,b,c,d : Prop) (a<->c) -> (b <-> d) -> (a -> b) -> (c -> d).
Tauto.
Save.