~ubuntu-branches/ubuntu/hardy/coq-doc/hardy

« back to all changes in this revision

Viewing changes to library/Coq.Logic.Eqdep_dec.html

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2004-09-18 13:28:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040918132822-ees5mb8qmzd6a0fw
Tags: 8.0pl1.0-1
* Added the Coq faq, moved the tutorial to the root directory and added
  doc-base files for both, closes: #272204.
* Set dh_compat to level 4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html xmlns="http://www.w3.org/1999/xhtml">
 
2
<head>
 
3
<meta http-equiv="Content-Type" content="text/html; charset="><link rel="stylesheet" href="style.css" type="text/css"><title>Coq.Logic.Eqdep_dec</title>
 
4
</head>
 
5
 
 
6
<body>
 
7
 
 
8
<h1>Library Coq.Logic.Eqdep_dec</h1>
 
9
 
 
10
<code>
 
11
</code>
 
12
 
 
13
<table width="100%"><tr class="doc"><td>
 
14
We prove that there is only one proof of <code>x=x</code>, i.e <code>(refl_equal ? x)</code>.
 
15
   This holds if the equality upon the set of <code>x</code> is decidable.
 
16
   A corollary of this theorem is the equality of the right projections
 
17
   of two equal dependent pairs.
 
18
 
 
19
<br/><br/>
 
20
   Author:   Thomas Kleymann |&lt;tms@dcs.ed.ac.uk&gt;| in Lego
 
21
             adapted to Coq by B. Barras
 
22
 
 
23
<br/><br/>
 
24
   Credit:   Proofs up to <code>K_dec</code> follows an outline by Michael Hedberg
 
25
 
 
26
</td></tr></table>
 
27
<code>
 
28
 
 
29
<br/>
 
30
</code>
 
31
 
 
32
<table width="100%"><tr class="doc"><td>
 
33
We need some dependent elimination schemes 
 
34
</td></tr></table>
 
35
<code>
 
36
 
 
37
<br/>
 
38
Set <code class="keyword">Implicit</code> Arguments.<br/>
 
39
 
 
40
<br/>
 
41
</code>
 
42
 
 
43
<table width="100%"><tr class="doc"><td>
 
44
Bijection between <code>eq</code> and <code>eqT</code> 
 
45
</td></tr></table>
 
46
<code>
 
47
&nbsp;&nbsp;<code class="keyword">Definition</code> <a name="eq2eqT"></a>eq2eqT (A:Set) (x y:A) (eqxy:x = y) : <br/>
 
48
&nbsp;&nbsp;&nbsp;&nbsp;x = y :=<br/>
 
49
&nbsp;&nbsp;&nbsp;&nbsp;match eqxy in (_ = y) return x = y with<br/>
 
50
&nbsp;&nbsp;&nbsp;&nbsp;| <a href="Coq.Init.Logic.html#refl_equal">refl_equal</a> =&gt; <a href="Coq.Init.Logic.html#refl_equal">refl_equal</a> x<br/>
 
51
&nbsp;&nbsp;&nbsp;&nbsp;end.<br/>
 
52
 
 
53
<br/>
 
54
&nbsp;&nbsp;<code class="keyword">Definition</code> <a name="eqT2eq"></a>eqT2eq (A:Set) (x y:A) (eqTxy:x = y) : <br/>
 
55
&nbsp;&nbsp;&nbsp;&nbsp;x = y :=<br/>
 
56
&nbsp;&nbsp;&nbsp;&nbsp;match eqTxy in (_ = y) return x = y with<br/>
 
57
&nbsp;&nbsp;&nbsp;&nbsp;| <a href="Coq.Init.Logic.html#refl_equal">refl_equal</a> =&gt; <a href="Coq.Init.Logic.html#refl_equal">refl_equal</a> x<br/>
 
58
&nbsp;&nbsp;&nbsp;&nbsp;end.<br/>
 
59
 
 
60
<br/>
 
61
&nbsp;&nbsp;<code class="keyword">Lemma</code> <a name="eq_eqT_bij"></a>eq_eqT_bij : forall (A:Set) (x y:A) (p:x = y), p = <a href="Coq.Logic.Eqdep_dec.html#eqT2eq">eqT2eq</a> (<a href="Coq.Logic.Eqdep_dec.html#eq2eqT">eq2eqT</a> p).<br/>
 
62
intros.<br/>
 
63
case p; reflexivity.<br/>
 
64
<code class="keyword">Qed</code>.<br/>
 
65
 
 
66
<br/>
 
67
&nbsp;&nbsp;<code class="keyword">Lemma</code> <a name="eqT_eq_bij"></a>eqT_eq_bij : forall (A:Set) (x y:A) (p:x = y), p = <a href="Coq.Logic.Eqdep_dec.html#eq2eqT">eq2eqT</a> (<a href="Coq.Logic.Eqdep_dec.html#eqT2eq">eqT2eq</a> p).<br/>
 
68
intros.<br/>
 
69
case p; reflexivity.<br/>
 
70
<code class="keyword">Qed</code>.<br/>
 
71
 
 
72
<br/>
 
73
<code class="keyword">Section</code> DecidableEqDep.<br/>
 
74
 
 
75
<br/>
 
76
&nbsp;&nbsp;  <code class="keyword">Variable</code> A : Type.<br/>
 
77
 
 
78
<br/>
 
79
&nbsp;&nbsp;<code class="keyword">Let</code> comp (x y y':A) (eq1:x = y) (eq2:x = y') : y = y' :=<br/>
 
80
&nbsp;&nbsp;&nbsp;&nbsp;<a href="Coq.Init.Logic.html#eq_ind">eq_ind</a> _ (fun a =&gt; a = y') eq2 _ eq1.<br/>
 
81
 
 
82
<br/>
 
83
&nbsp;&nbsp;<code class="keyword">Remark</code> trans_sym_eqT : forall (x y:A) (u:x = y), comp u u = <a href="Coq.Init.Logic.html#refl_equal">refl_equal</a> y.<br/>
 
84
intros.<br/>
 
85
case u; trivial.<br/>
 
86
<code class="keyword">Qed</code>.<br/>
 
87
 
 
88
<br/>
 
89
&nbsp;&nbsp;  <code class="keyword">Variable</code> eq_dec : forall x y:A, x = y \/ x &lt;&gt; y.<br/>
 
90
 
 
91
<br/>
 
92
&nbsp;&nbsp;  <code class="keyword">Variable</code> x : A.<br/>
 
93
 
 
94
<br/>
 
95
&nbsp;&nbsp;<code class="keyword">Let</code> nu (y:A) (u:x = y) : x = y :=<br/>
 
96
&nbsp;&nbsp;&nbsp;&nbsp;match eq_dec x y with<br/>
 
97
&nbsp;&nbsp;&nbsp;&nbsp;| <a href="Coq.Init.Logic.html#or_introl">or_introl</a> eqxy =&gt; eqxy<br/>
 
98
&nbsp;&nbsp;&nbsp;&nbsp;| <a href="Coq.Init.Logic.html#or_intror">or_intror</a> neqxy =&gt; <a href="Coq.Init.Logic.html#False_ind">False_ind</a> _ (neqxy u)<br/>
 
99
&nbsp;&nbsp;&nbsp;&nbsp;end.<br/>
 
100
 
 
101
<br/>
 
102
&nbsp;&nbsp;<code class="keyword">Let</code> nu_constant : forall (y:A) (u v:x = y), nu u = nu v.<br/>
 
103
intros.<br/>
 
104
unfold nu in |- *.<br/>
 
105
case (eq_dec x y); intros.<br/>
 
106
reflexivity.<br/>
 
107
 
 
108
<br/>
 
109
case n; trivial.<br/>
 
110
<code class="keyword">Qed</code>.<br/>
 
111
 
 
112
<br/>
 
113
&nbsp;&nbsp;<code class="keyword">Let</code> nu_inv (y:A) (v:x = y) : x = y := comp (nu (<a href="Coq.Init.Logic.html#refl_equal">refl_equal</a> x)) v.<br/>
 
114
 
 
115
<br/>
 
116
&nbsp;&nbsp;<code class="keyword">Remark</code> nu_left_inv : forall (y:A) (u:x = y), nu_inv (nu u) = u.<br/>
 
117
intros.<br/>
 
118
case u; unfold nu_inv in |- *.<br/>
 
119
apply <a href="Coq.Logic.Eqdep_dec.html#trans_sym_eqT">trans_sym_eqT</a>.<br/>
 
120
<code class="keyword">Qed</code>.<br/>
 
121
 
 
122
<br/>
 
123
&nbsp;&nbsp;<code class="keyword">Theorem</code> <a name="eq_proofs_unicity"></a>eq_proofs_unicity : forall (y:A) (p1 p2:x = y), p1 = p2.<br/>
 
124
intros.<br/>
 
125
elim <a href="Coq.Logic.Eqdep_dec.html#nu_left_inv">nu_left_inv</a> with (u:= p1).<br/>
 
126
elim <a href="Coq.Logic.Eqdep_dec.html#nu_left_inv">nu_left_inv</a> with (u:= p2).<br/>
 
127
elim nu_constant with y p1 p2.<br/>
 
128
reflexivity.<br/>
 
129
<code class="keyword">Qed</code>.<br/>
 
130
 
 
131
<br/>
 
132
&nbsp;&nbsp;<code class="keyword">Theorem</code> <a name="K_dec"></a>K_dec :<br/>
 
133
&nbsp;&nbsp;&nbsp;forall P:x = x -&gt; Prop, P (<a href="Coq.Init.Logic.html#refl_equal">refl_equal</a> x) -&gt; forall p:x = x, P p.<br/>
 
134
intros.<br/>
 
135
elim <a href="Coq.Logic.Eqdep_dec.html#eq_proofs_unicity">eq_proofs_unicity</a> with x (<a href="Coq.Init.Logic.html#refl_equal">refl_equal</a> x) p.<br/>
 
136
trivial.<br/>
 
137
<code class="keyword">Qed</code>.<br/>
 
138
 
 
139
<br/>
 
140
</code>
 
141
 
 
142
<table width="100%"><tr class="doc"><td>
 
143
The corollary 
 
144
</td></tr></table>
 
145
<code>
 
146
 
 
147
<br/>
 
148
&nbsp;&nbsp;<code class="keyword">Let</code> proj (P:A -&gt; Prop) (exP:<a href="Coq.Init.Logic.html#ex">ex</a> P) (def:P x) : P x :=<br/>
 
149
&nbsp;&nbsp;&nbsp;&nbsp;match exP with<br/>
 
150
&nbsp;&nbsp;&nbsp;&nbsp;| <a href="Coq.Init.Logic.html#ex_intro">ex_intro</a> x' prf =&gt;<br/>
 
151
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;match eq_dec x' x with<br/>
 
152
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| <a href="Coq.Init.Logic.html#or_introl">or_introl</a> eqprf =&gt; <a href="Coq.Init.Logic.html#eq_ind">eq_ind</a> x' P prf x eqprf<br/>
 
153
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| _ =&gt; def<br/>
 
154
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br/>
 
155
&nbsp;&nbsp;&nbsp;&nbsp;end.<br/>
 
156
 
 
157
<br/>
 
158
&nbsp;&nbsp;<code class="keyword">Theorem</code> <a name="inj_right_pair"></a>inj_right_pair :<br/>
 
159
&nbsp;&nbsp;&nbsp;forall (P:A -&gt; Prop) (y y':P x),<br/>
 
160
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="Coq.Init.Logic.html#ex_intro">ex_intro</a> P x y = <a href="Coq.Init.Logic.html#ex_intro">ex_intro</a> P x y' -&gt; y = y'.<br/>
 
161
intros.<br/>
 
162
cut (proj (<a href="Coq.Init.Logic.html#ex_intro">ex_intro</a> P x y) y = proj (<a href="Coq.Init.Logic.html#ex_intro">ex_intro</a> P x y') y).<br/>
 
163
simpl in |- *.<br/>
 
164
case (eq_dec x x).<br/>
 
165
intro e.<br/>
 
166
elim e using <a href="Coq.Logic.Eqdep_dec.html#K_dec">K_dec</a>; trivial.<br/>
 
167
 
 
168
<br/>
 
169
intros.<br/>
 
170
case n; trivial.<br/>
 
171
 
 
172
<br/>
 
173
case H.<br/>
 
174
reflexivity.<br/>
 
175
<code class="keyword">Qed</code>.<br/>
 
176
 
 
177
<br/>
 
178
<code class="keyword">End</code> DecidableEqDep.<br/>
 
179
 
 
180
<br/>
 
181
</code>
 
182
 
 
183
<table width="100%"><tr class="doc"><td>
 
184
We deduce the <code>K</code> axiom for (decidable) Set 
 
185
</td></tr></table>
 
186
<code>
 
187
&nbsp;&nbsp;<code class="keyword">Theorem</code> <a name="K_dec_set"></a>K_dec_set :<br/>
 
188
&nbsp;&nbsp;&nbsp;forall A:Set,<br/>
 
189
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(forall x y:A, {x = y} + {x &lt;&gt; y}) -&gt;<br/>
 
190
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;forall (x:A) (P:x = x -&gt; Prop), P (<a href="Coq.Init.Logic.html#refl_equal">refl_equal</a> x) -&gt; forall p:x = x, P p.<br/>
 
191
intros.<br/>
 
192
rewrite <a href="Coq.Logic.Eqdep_dec.html#eq_eqT_bij">eq_eqT_bij</a>.<br/>
 
193
elim (<a href="Coq.Logic.Eqdep_dec.html#eq2eqT">eq2eqT</a> p) using <a href="Coq.Logic.Eqdep_dec.html#K_dec">K_dec</a>.<br/>
 
194
intros.<br/>
 
195
case (H x0 y); intros.<br/>
 
196
elim e; left; reflexivity.<br/>
 
197
 
 
198
<br/>
 
199
right; red in |- *; intro neq; apply n; elim neq; reflexivity.<br/>
 
200
 
 
201
<br/>
 
202
trivial.<br/>
 
203
<code class="keyword">Qed</code>.</code>
 
204
<hr/><a href="index.html">Index</a><hr/><font size="-1">This page has been generated by <a href="http://www.lri.fr/~filliatr/coqdoc/">coqdoc</a></font>
 
205
</body>
 
206
</html>
 
 
b'\\ No newline at end of file'