~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to test-suite/success/cc.v

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu, Stéphane Glondu, Samuel Mimram
  • Date: 2010-01-07 22:50:39 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100107225039-n3cq82589u0qt0s2
Tags: 8.2pl1-1
[ Stéphane Glondu ]
* New upstream release (Closes: #563669)
  - remove patches
* Packaging overhaul:
  - use git, advertise it in Vcs-* fields of debian/control
  - use debhelper 7 and dh with override
  - use source format 3.0 (quilt)
* debian/control:
  - set Maintainer to d-o-m, set Uploaders to Sam and myself
  - add Homepage field
  - bump Standards-Version to 3.8.3
* Register PDF documentation into doc-base
* Add debian/watch
* Update debian/copyright

[ Samuel Mimram ]
* Change coq-doc's description to mention that it provides documentation in
  pdf format, not postscript, closes: #543545.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
Theorem t1 : forall (A : Set) (a : A) (f : A -> A), f a = a -> f (f a) = a.
 
3
intros.
 
4
 congruence.
 
5
Qed.
 
6
 
 
7
Theorem t2 :
 
8
 forall (A : Set) (a b : A) (f : A -> A) (g : A -> A -> A),
 
9
 a = f a -> g b (f a) = f (f a) -> g a b = f (g b a) -> g a b = a.
 
10
intros.
 
11
 congruence.
 
12
Qed.
 
13
 
 
14
(* 15=0 /\ 10=0 /\ 6=0 -> 0=1 *)
 
15
 
 
16
Theorem t3 :
 
17
 forall (N : Set) (o : N) (s d : N -> N),
 
18
 s (s (s (s (s (s (s (s (s (s (s (s (s (s (s o)))))))))))))) = o ->
 
19
 s (s (s (s (s (s (s (s (s (s o))))))))) = o ->
 
20
 s (s (s (s (s (s o))))) = o -> o = s o.
 
21
intros.
 
22
 congruence.
 
23
Qed.
 
24
 
 
25
(* Examples that fail due to dependencies *) 
 
26
 
 
27
(* yields transitivity problem *)
 
28
 
 
29
Theorem dep :
 
30
 forall (A : Set) (P : A -> Set) (f g : forall x : A, P x) 
 
31
   (x y : A) (e : x = y) (e0 : f y = g y), f x = g x.
 
32
intros;  dependent rewrite e; exact e0.
 
33
Qed.
 
34
 
 
35
(* yields congruence problem *)
 
36
 
 
37
Theorem dep2 :
 
38
 forall (A B : Set)
 
39
   (f : forall (A : Set) (b : bool), if b then unit else A -> unit)
 
40
   (e : A = B), f A true = f B true.
 
41
intros;  rewrite e; reflexivity.
 
42
Qed.
 
43
 
 
44
 
 
45
(* example that Congruence. can solve   
 
46
        (dependent function applied to the same argument)*) 
 
47
 
 
48
Theorem dep3 :
 
49
 forall (A : Set) (P : A -> Set) (f g : forall x : A, P x),
 
50
 f = g -> forall x : A, f x = g x.              intros. 
 
51
 congruence.
 
52
Qed.
 
53
 
 
54
(* Examples with injection rule *)
 
55
 
 
56
Theorem inj1 :
 
57
 forall (A : Set) (a b c d : A), (a, c) = (b, d) -> a = b /\ c = d.
 
58
intros.
 
59
split;  congruence.
 
60
Qed.
 
61
 
 
62
Theorem inj2 :
 
63
 forall (A : Set) (a c d : A) (f : A -> A * A),
 
64
 f = pair (B:=A) a -> Some (f c) = Some (f d) -> c = d.                             
 
65
intros.
 
66
 congruence.
 
67
Qed.
 
68
 
 
69
(* Examples with discrimination rule *)
 
70
 
 
71
Theorem discr1 : true = false -> False.
 
72
intros.
 
73
 congruence.
 
74
Qed.
 
75
 
 
76
Theorem discr2 : Some true = Some false -> False.
 
77
intros.
 
78
 congruence.
 
79
Qed.
 
80
 
 
81
(* example with implications *)
 
82
 
 
83
Theorem arrow : forall (A B: Prop) (C D:Set) , A=B -> C=D  -> 
 
84
(A -> C) = (B -> D).
 
85
congruence.
 
86
Qed.
 
87
 
 
88
 
 
89
Set Implicit Arguments.
 
90
 
 
91
Parameter elt: Set.
 
92
Parameter elt_eq: forall (x y: elt), {x = y} + {x <> y}.
 
93
Definition t (A: Set) := elt -> A.
 
94
Definition get (A: Set) (x: elt) (m: t A) := m x.
 
95
Definition set (A: Set) (x: elt) (v: A) (m: t A) :=
 
96
    fun (y: elt) => if elt_eq y x then v else m y.
 
97
Lemma gsident:
 
98
  forall (A: Set) (i j: elt) (m: t A), get j (set i (get i m) m) = get j m.
 
99
Proof.
 
100
  intros. unfold get, set. case (elt_eq j i); intro.
 
101
  congruence.
 
102
  auto.
 
103
Qed.
 
104
            
 
105
 
 
106
            
 
107
            
 
 
b'\\ No newline at end of file'