-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompcert.lib.BoolEqual.html
246 lines (196 loc) · 53.2 KB
/
compcert.lib.BoolEqual.html
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="coqdoc.css" rel="stylesheet" type="text/css" />
<title>compcert.lib.BoolEqual</title>
</head>
<body>
<div id="page">
<div id="header">
</div>
<div id="main">
<h1 class="libtitle">Library compcert.lib.BoolEqual</h1>
<div class="code">
<br/>
</div>
<div class="doc">
Tactics to generate Boolean-valued equalities
<div class="paragraph"> </div>
The <span class="inlinecode"><a class="idref" href="liblayers.lib.Decision.html#decide"><span class="id" title="projection">decide</span></a></span> <span class="inlinecode"><span class="id" title="var">equality</span></span> tactic can generate a term of type
<span class="inlinecode"><span class="id" title="keyword">∀</span></span> <span class="inlinecode">(<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a></span> <span class="inlinecode"><a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>:</span> <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a>),</span> <span class="inlinecode">{<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a>=<a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>}</span> <span class="inlinecode">+</span> <span class="inlinecode">{<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a>≠<a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>}</span> if <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a></span> is an inductive type.
This term is a decidable equality function.
<div class="paragraph"> </div>
Similarly, this module defines a <span class="inlinecode"><span class="id" title="var">boolean_equality</span></span> tactic that generates
a term of type <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a></span> <span class="inlinecode">→</span> <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a></span> <span class="inlinecode">→</span> <span class="inlinecode"><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a></span>. This term is a Boolean-valued equality
function over the inductive type <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a></span>. Two internal tactics generate
proofs that show the correctness of this equality function <span class="inlinecode"><a class="idref" href="compcert.backend.Bounds.html#BOUNDS.f"><span class="id" title="variable">f</span></a></span>, namely
proofs of the following two properties:
<ul class="doclist">
<li> <span class="inlinecode"><span class="id" title="keyword">∀</span></span> <span class="inlinecode">(<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a>:</span> <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a>),</span> <span class="inlinecode"><a class="idref" href="compcert.backend.Bounds.html#BOUNDS.f"><span class="id" title="variable">f</span></a></span> <span class="inlinecode"><a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a></span> <span class="inlinecode"><a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a></span> <span class="inlinecode">=</span> <span class="inlinecode"><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a></span>
</li>
<li> <span class="inlinecode"><span class="id" title="keyword">∀</span></span> <span class="inlinecode">(<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a></span> <span class="inlinecode"><a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>:</span> <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a>),</span> <span class="inlinecode"><a class="idref" href="compcert.backend.Bounds.html#BOUNDS.f"><span class="id" title="variable">f</span></a></span> <span class="inlinecode"><a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a></span> <span class="inlinecode"><a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a></span> <span class="inlinecode">=</span> <span class="inlinecode"><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a></span> <span class="inlinecode">→</span> <span class="inlinecode"><a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a></span> <span class="inlinecode">=</span> <span class="inlinecode"><a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a></span>
</li>
</ul>
<div class="paragraph"> </div>
Finally, the <span class="inlinecode"><span class="id" title="var">decide_equality_from</span></span> <span class="inlinecode"><a class="idref" href="compcert.backend.Bounds.html#BOUNDS.f"><span class="id" title="variable">f</span></a></span> tactic wraps <span class="inlinecode"><a class="idref" href="compcert.backend.Bounds.html#BOUNDS.f"><span class="id" title="variable">f</span></a></span> (the Boolean equality
generated by <span class="inlinecode"><span class="id" title="var">boolean_equality</span></span>) and those proofs together, producing
a decidable equality of type <span class="inlinecode"><span class="id" title="keyword">∀</span></span> <span class="inlinecode">(<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a></span> <span class="inlinecode"><a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>:</span> <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a>),</span> <span class="inlinecode">{<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a>=<a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>}</span> <span class="inlinecode">+</span> <span class="inlinecode">{<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a>≠<a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>}</span>.
<div class="paragraph"> </div>
The advantage of the present tactics over the standard <span class="inlinecode"><a class="idref" href="liblayers.lib.Decision.html#decide"><span class="id" title="projection">decide</span></a></span> <span class="inlinecode"><span class="id" title="var">equality</span></span>
tactic is that the former produce smaller transparent definitions than
the latter.
<div class="paragraph"> </div>
For a type <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a></span> that has N constructors, <span class="inlinecode"><a class="idref" href="liblayers.lib.Decision.html#decide"><span class="id" title="projection">decide</span></a></span> <span class="inlinecode"><span class="id" title="var">equality</span></span> produces a
single term of size O(N^3), which must be kept transparent so that
it computes and extracts as expected. Given such a big transparent
definition, the virtual machine compiler of Coq produces very big
chunks of VM code, causing memory overflows on 32-bit platforms.
<div class="paragraph"> </div>
In contrast, the term produced by <span class="inlinecode"><span class="id" title="var">boolean_equality</span></span> has size O(N^2)
only (so to speak). The proofs that this term is a correct boolean
equality are still O(N^3), but those proofs are opaque and do not need
to be compiled to VM code. Only the boolean equality itself is defined
transparently and compiled.
<div class="paragraph"> </div>
The present tactics also have some restrictions:
<ul class="doclist">
<li> Constructors must have at most 4 arguments.
</li>
<li> Decidable equalities must be provided (as hypotheses in the context)
for all the types <span class="inlinecode"><a class="idref" href="compcert.flocq.Appli.Fappli_IEEE.html#T"><span class="id" title="variable">T</span></a></span> of constructor arguments other than type <span class="inlinecode"><a class="idref" href="compcert.x86.Op.html#SOUNDNESS.A"><span class="id" title="variable">A</span></a></span>.
</li>
<li> They probably do not work for mutually-defined inductive types.
</li>
</ul>
</div>
<div class="code">
<br/>
<span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="compcert.lib.Coqlib.html#"><span class="id" title="library">Coqlib</span></a>.<br/>
<br/>
<span class="id" title="keyword">Module</span> <a name="BE"><span class="id" title="module">BE</span></a>.<br/>
<br/>
<span class="id" title="keyword">Definition</span> <a name="BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> {<span class="id" title="var">A</span>: <span class="id" title="keyword">Type</span>} (<span class="id" title="var">x</span> <span class="id" title="var">y</span>: <a class="idref" href="compcert.lib.BoolEqual.html#A"><span class="id" title="variable">A</span></a>) : <span class="id" title="keyword">Type</span> := <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a>.<br/>
<br/>
<span class="id" title="keyword">Ltac</span> <span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span> :=<br/>
<span class="id" title="tactic">change</span> (<a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> <span class="id" title="var">x</span> <span class="id" title="var">y</span>);<br/>
<span class="id" title="keyword">match</span> <span class="id" title="keyword">goal</span> <span class="id" title="keyword">with</span><br/>
| [ <span class="id" title="var">H</span>: <span class="id" title="keyword">∀</span> (<span class="id" title="var">x</span> <span class="id" title="var">y</span>: ?<span class="id" title="var">A</span>), <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a> |- @<a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> ?<span class="id" title="var">A</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span> ] ⇒ <span class="id" title="tactic">exact</span> (<span class="id" title="var">H</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span>)<br/>
| [ <span class="id" title="var">H</span>: <span class="id" title="keyword">∀</span> (<span class="id" title="var">x</span> <span class="id" title="var">y</span>: ?<span class="id" title="var">A</span>), <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">{</span></a><a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a><a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">+</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">{</span></a><a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#32263a1c8b01baecdff9deb038955bc9"><span class="id" title="notation">≠</span></a><a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}</span></a> |- @<a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> ?<span class="id" title="var">A</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span> ] ⇒ <span class="id" title="tactic">exact</span> (<a class="idref" href="compcert.lib.Coqlib.html#proj_sumbool"><span class="id" title="definition">proj_sumbool</span></a> (<span class="id" title="var">H</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span>))<br/>
| <span class="id" title="var">_</span> ⇒ <span class="id" title="tactic">idtac</span><br/>
<span class="id" title="keyword">end</span>.<br/>
<br/>
<span class="id" title="keyword">Ltac</span> <span class="id" title="var">bool_eq_case</span> :=<br/>
<span class="id" title="keyword">match</span> <span class="id" title="keyword">goal</span> <span class="id" title="keyword">with</span><br/>
| |- <a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> (?<span class="id" title="var">C</span> ?<span class="id" title="var">x1</span> ?<span class="id" title="var">x2</span> ?<span class="id" title="var">x3</span> ?<span class="id" title="var">x4</span>) (?<span class="id" title="var">C</span> ?<span class="id" title="var">y1</span> ?<span class="id" title="var">y2</span> ?<span class="id" title="var">y3</span> ?<span class="id" title="var">y4</span>) ⇒<br/>
<span class="id" title="tactic">refine</span> (<span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#49ac24efa716d8b0ee8943bc1d1769a9"><span class="id" title="notation">&&</span></a> <span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#49ac24efa716d8b0ee8943bc1d1769a9"><span class="id" title="notation">&&</span></a> <span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#49ac24efa716d8b0ee8943bc1d1769a9"><span class="id" title="notation">&&</span></a> <span class="id" title="var">_</span>); [<span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x1</span> <span class="id" title="var">y1</span>|<span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x2</span> <span class="id" title="var">y2</span>|<span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x3</span> <span class="id" title="var">y3</span>|<span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x4</span> <span class="id" title="var">y4</span>]<br/>
| |- <a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> (?<span class="id" title="var">C</span> ?<span class="id" title="var">x1</span> ?<span class="id" title="var">x2</span> ?<span class="id" title="var">x3</span>) (?<span class="id" title="var">C</span> ?<span class="id" title="var">y1</span> ?<span class="id" title="var">y2</span> ?<span class="id" title="var">y3</span>) ⇒<br/>
<span class="id" title="tactic">refine</span> (<span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#49ac24efa716d8b0ee8943bc1d1769a9"><span class="id" title="notation">&&</span></a> <span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#49ac24efa716d8b0ee8943bc1d1769a9"><span class="id" title="notation">&&</span></a> <span class="id" title="var">_</span>); [<span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x1</span> <span class="id" title="var">y1</span>|<span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x2</span> <span class="id" title="var">y2</span>|<span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x3</span> <span class="id" title="var">y3</span>]<br/>
| |- <a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> (?<span class="id" title="var">C</span> ?<span class="id" title="var">x1</span> ?<span class="id" title="var">x2</span>) (?<span class="id" title="var">C</span> ?<span class="id" title="var">y1</span> ?<span class="id" title="var">y2</span>) ⇒<br/>
<span class="id" title="tactic">refine</span> (<span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#49ac24efa716d8b0ee8943bc1d1769a9"><span class="id" title="notation">&&</span></a> <span class="id" title="var">_</span>); [<span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x1</span> <span class="id" title="var">y1</span>|<span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x2</span> <span class="id" title="var">y2</span>]<br/>
| |- <a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> (?<span class="id" title="var">C</span> ?<span class="id" title="var">x1</span>) (?<span class="id" title="var">C</span> ?<span class="id" title="var">y1</span>) ⇒ <span class="id" title="var">bool_eq_base</span> <span class="id" title="var">x1</span> <span class="id" title="var">y1</span><br/>
| |- <a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> ?<span class="id" title="var">C</span> ?<span class="id" title="var">C</span> ⇒ <span class="id" title="tactic">exact</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a><br/>
| |- <a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> <span class="id" title="var">_</span> <span class="id" title="var">_</span> ⇒ <span class="id" title="tactic">exact</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#false"><span class="id" title="constructor">false</span></a><br/>
<span class="id" title="keyword">end</span>.<br/>
<br/>
<span class="id" title="keyword">Ltac</span> <span class="id" title="var">bool_eq</span> :=<br/>
<span class="id" title="keyword">match</span> <span class="id" title="keyword">goal</span> <span class="id" title="keyword">with</span><br/>
| [ |- ?<span class="id" title="var">A</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">→</span></a> ?<span class="id" title="var">A</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">→</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a> ] ⇒<br/>
<span class="id" title="keyword">let</span> <span class="id" title="var">f</span> := <span class="id" title="tactic">fresh</span> "rec" <span class="id" title="keyword">in</span> <span class="id" title="keyword">let</span> <span class="id" title="var">x</span> := <span class="id" title="tactic">fresh</span> "x" <span class="id" title="keyword">in</span> <span class="id" title="keyword">let</span> <span class="id" title="var">y</span> := <span class="id" title="tactic">fresh</span> "y" <span class="id" title="keyword">in</span><br/>
<span class="id" title="keyword">fix</span> <span class="id" title="var">f</span> 1; <span class="id" title="tactic">intros</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span>; <span class="id" title="tactic">change</span> (<a class="idref" href="compcert.lib.BoolEqual.html#BE.bool_eq"><span class="id" title="definition">bool_eq</span></a> <span class="id" title="var">x</span> <span class="id" title="var">y</span>); <span class="id" title="tactic">destruct</span> <span class="id" title="var">x</span>, <span class="id" title="var">y</span>; <span class="id" title="var">bool_eq_case</span><br/>
| [ |- <span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">→</span></a> <span class="id" title="var">_</span> ] ⇒<br/>
<span class="id" title="keyword">let</span> <span class="id" title="var">eq</span> := <span class="id" title="tactic">fresh</span> "eq" <span class="id" title="keyword">in</span> <span class="id" title="tactic">intro</span> <span class="id" title="var">eq</span>; <span class="id" title="var">bool_eq</span><br/>
<span class="id" title="keyword">end</span>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a name="BE.proj_sumbool_is_true"><span class="id" title="lemma">proj_sumbool_is_true</span></a>:<br/>
<span class="id" title="keyword">∀</span> (<span class="id" title="var">A</span>: <span class="id" title="keyword">Type</span>) (<span class="id" title="var">f</span>: <span class="id" title="keyword">∀</span> (<span class="id" title="var">x</span> <span class="id" title="var">y</span>: <a class="idref" href="compcert.lib.BoolEqual.html#A"><span class="id" title="variable">A</span></a>), <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">{</span></a><a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a><a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">+</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">{</span></a><a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#32263a1c8b01baecdff9deb038955bc9"><span class="id" title="notation">≠</span></a><a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}</span></a>) (<span class="id" title="var">x</span>: <a class="idref" href="compcert.lib.BoolEqual.html#A"><span class="id" title="variable">A</span></a>), <br/>
<a class="idref" href="compcert.lib.Coqlib.html#proj_sumbool"><span class="id" title="definition">proj_sumbool</span></a> (<a class="idref" href="compcert.lib.BoolEqual.html#f"><span class="id" title="variable">f</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a>) <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a>.<br/>
<span class="id" title="keyword">Proof</span>.<br/>
<span class="id" title="tactic">intros</span>. <span class="id" title="tactic">unfold</span> <a class="idref" href="compcert.lib.Coqlib.html#proj_sumbool"><span class="id" title="definition">proj_sumbool</span></a>. <span class="id" title="tactic">destruct</span> (<span class="id" title="var">f</span> <span class="id" title="var">x</span> <span class="id" title="var">x</span>). <span class="id" title="tactic">auto</span>. <span class="id" title="tactic">elim</span> <span class="id" title="var">n</span>; <span class="id" title="tactic">auto</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
<br/>
<span class="id" title="keyword">Ltac</span> <span class="id" title="var">bool_eq_refl_case</span> :=<br/>
<span class="id" title="keyword">match</span> <span class="id" title="keyword">goal</span> <span class="id" title="keyword">with</span><br/>
| [ |- <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> ] ⇒ <span class="id" title="tactic">reflexivity</span><br/>
| [ |- <a class="idref" href="compcert.lib.Coqlib.html#proj_sumbool"><span class="id" title="definition">proj_sumbool</span></a> <span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> ] ⇒ <span class="id" title="tactic">apply</span> <a class="idref" href="compcert.lib.BoolEqual.html#BE.proj_sumbool_is_true"><span class="id" title="lemma">proj_sumbool_is_true</span></a><br/>
| [ |- <span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#49ac24efa716d8b0ee8943bc1d1769a9"><span class="id" title="notation">&&</span></a> <span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> ] ⇒ <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Bool.Bool.html#andb_true_iff"><span class="id" title="lemma">andb_true_iff</span></a>; <span class="id" title="tactic">split</span>; <span class="id" title="var">bool_eq_refl_case</span><br/>
| <span class="id" title="var">_</span> ⇒ <span class="id" title="tactic">auto</span><br/>
<span class="id" title="keyword">end</span>.<br/>
<br/>
<span class="id" title="keyword">Ltac</span> <span class="id" title="var">bool_eq_refl</span> :=<br/>
<span class="id" title="keyword">let</span> <span class="id" title="var">H</span> := <span class="id" title="tactic">fresh</span> "Hrec" <span class="id" title="keyword">in</span> <span class="id" title="keyword">let</span> <span class="id" title="var">x</span> := <span class="id" title="tactic">fresh</span> "x" <span class="id" title="keyword">in</span><br/>
<span class="id" title="keyword">fix</span> <span class="id" title="var">H</span> 1; <span class="id" title="tactic">intros</span> <span class="id" title="var">x</span>; <span class="id" title="tactic">destruct</span> <span class="id" title="var">x</span>; <span class="id" title="tactic">simpl</span>; <span class="id" title="var">bool_eq_refl_case</span>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a name="BE.false_not_true"><span class="id" title="lemma">false_not_true</span></a>:<br/>
<span class="id" title="keyword">∀</span> (<span class="id" title="var">P</span>: <span class="id" title="keyword">Prop</span>), <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#false"><span class="id" title="constructor">false</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">→</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#P"><span class="id" title="variable">P</span></a>.<br/>
<span class="id" title="keyword">Proof</span>.<br/>
<span class="id" title="tactic">intros</span>. <span class="id" title="tactic">discriminate</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a name="BE.proj_sumbool_true"><span class="id" title="lemma">proj_sumbool_true</span></a>:<br/>
<span class="id" title="keyword">∀</span> (<span class="id" title="var">A</span>: <span class="id" title="keyword">Type</span>) (<span class="id" title="var">x</span> <span class="id" title="var">y</span>: <a class="idref" href="compcert.lib.BoolEqual.html#A"><span class="id" title="variable">A</span></a>) (<span class="id" title="var">a</span>: <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">{</span></a><a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a><a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">+</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">{</span></a><a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#32263a1c8b01baecdff9deb038955bc9"><span class="id" title="notation">≠</span></a><a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}</span></a>),<br/>
<a class="idref" href="compcert.lib.Coqlib.html#proj_sumbool"><span class="id" title="definition">proj_sumbool</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#a"><span class="id" title="variable">a</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">→</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a>.<br/>
<span class="id" title="keyword">Proof</span>.<br/>
<span class="id" title="tactic">intros</span>. <span class="id" title="tactic">destruct</span> <span class="id" title="var">a</span>. <span class="id" title="tactic">auto</span>. <span class="id" title="tactic">discriminate</span>.<br/>
<span class="id" title="keyword">Qed</span>.<br/>
<br/>
<span class="id" title="keyword">Ltac</span> <span class="id" title="var">bool_eq_sound_case</span> :=<br/>
<span class="id" title="keyword">match</span> <span class="id" title="keyword">goal</span> <span class="id" title="keyword">with</span><br/>
| [ <span class="id" title="var">H</span>: <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#false"><span class="id" title="constructor">false</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> |- <span class="id" title="var">_</span> ] ⇒ <span class="id" title="tactic">exact</span> (<a class="idref" href="compcert.lib.BoolEqual.html#BE.false_not_true"><span class="id" title="lemma">false_not_true</span></a> <span class="id" title="var">_</span> <span class="id" title="var">H</span>)<br/>
| [ <span class="id" title="var">H</span>: <span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#49ac24efa716d8b0ee8943bc1d1769a9"><span class="id" title="notation">&&</span></a> <span class="id" title="var">_</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> |- <span class="id" title="var">_</span> ] ⇒ <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#andb_prop"><span class="id" title="lemma">andb_prop</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">H</span>; <span class="id" title="tactic">destruct</span> <span class="id" title="var">H</span>; <span class="id" title="var">bool_eq_sound_case</span><br/>
| [ <span class="id" title="var">H</span>: <a class="idref" href="compcert.lib.Coqlib.html#proj_sumbool"><span class="id" title="definition">proj_sumbool</span></a> ?<span class="id" title="var">a</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> |- <span class="id" title="var">_</span> ] ⇒ <span class="id" title="tactic">apply</span> <a class="idref" href="compcert.lib.BoolEqual.html#BE.proj_sumbool_true"><span class="id" title="lemma">proj_sumbool_true</span></a> <span class="id" title="keyword">in</span> <span class="id" title="var">H</span>; <span class="id" title="var">bool_eq_sound_case</span><br/>
| [ |- ?<span class="id" title="var">C</span> ?<span class="id" title="var">x1</span> ?<span class="id" title="var">x2</span> ?<span class="id" title="var">x3</span> ?<span class="id" title="var">x4</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> ?<span class="id" title="var">C</span> ?<span class="id" title="var">y1</span> ?<span class="id" title="var">y2</span> ?<span class="id" title="var">y3</span> ?<span class="id" title="var">y4</span> ] ⇒ <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#f_equal4"><span class="id" title="lemma">f_equal4</span></a>; <span class="id" title="tactic">auto</span><br/>
| [ |- ?<span class="id" title="var">C</span> ?<span class="id" title="var">x1</span> ?<span class="id" title="var">x2</span> ?<span class="id" title="var">x3</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> ?<span class="id" title="var">C</span> ?<span class="id" title="var">y1</span> ?<span class="id" title="var">y2</span> ?<span class="id" title="var">y3</span> ] ⇒ <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#f_equal3"><span class="id" title="lemma">f_equal3</span></a>; <span class="id" title="tactic">auto</span><br/>
| [ |- ?<span class="id" title="var">C</span> ?<span class="id" title="var">x1</span> ?<span class="id" title="var">x2</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> ?<span class="id" title="var">C</span> ?<span class="id" title="var">y1</span> ?<span class="id" title="var">y2</span> ] ⇒ <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#f_equal2"><span class="id" title="lemma">f_equal2</span></a>; <span class="id" title="tactic">auto</span><br/>
| [ |- ?<span class="id" title="var">C</span> ?<span class="id" title="var">x1</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> ?<span class="id" title="var">C</span> ?<span class="id" title="var">y1</span> ] ⇒ <span class="id" title="tactic">apply</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#f_equal"><span class="id" title="lemma">f_equal</span></a>; <span class="id" title="tactic">auto</span><br/>
| [ |- ?<span class="id" title="var">x</span> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> ?<span class="id" title="var">x</span> ] ⇒ <span class="id" title="tactic">reflexivity</span><br/>
| <span class="id" title="var">_</span> ⇒ <span class="id" title="tactic">idtac</span><br/>
<span class="id" title="keyword">end</span>.<br/>
<br/>
<span class="id" title="keyword">Ltac</span> <span class="id" title="var">bool_eq_sound</span> :=<br/>
<span class="id" title="keyword">let</span> <span class="id" title="var">Hrec</span> := <span class="id" title="tactic">fresh</span> "Hrec" <span class="id" title="keyword">in</span> <span class="id" title="keyword">let</span> <span class="id" title="var">x</span> := <span class="id" title="tactic">fresh</span> "x" <span class="id" title="keyword">in</span> <span class="id" title="keyword">let</span> <span class="id" title="var">y</span> := <span class="id" title="tactic">fresh</span> "y" <span class="id" title="keyword">in</span><br/>
<span class="id" title="keyword">fix</span> <span class="id" title="var">Hrec</span> 1; <span class="id" title="tactic">intros</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span>; <span class="id" title="tactic">destruct</span> <span class="id" title="var">x</span>, <span class="id" title="var">y</span>; <span class="id" title="tactic">simpl</span>; <span class="id" title="tactic">intro</span>; <span class="id" title="var">bool_eq_sound_case</span>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a name="BE.dec_eq_from_bool_eq"><span class="id" title="lemma">dec_eq_from_bool_eq</span></a>:<br/>
<span class="id" title="keyword">∀</span> (<span class="id" title="var">A</span>: <span class="id" title="keyword">Type</span>) (<span class="id" title="var">f</span>: <a class="idref" href="compcert.lib.BoolEqual.html#A"><span class="id" title="variable">A</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">→</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#A"><span class="id" title="variable">A</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">→</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a>)<br/>
(<span class="id" title="var">f_refl</span>: <span class="id" title="keyword">∀</span> <span class="id" title="var">x</span>, <a class="idref" href="compcert.lib.BoolEqual.html#f"><span class="id" title="variable">f</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a>) (<span class="id" title="var">f_sound</span>: <span class="id" title="keyword">∀</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span>, <a class="idref" href="compcert.lib.BoolEqual.html#f"><span class="id" title="variable">f</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#d43e996736952df71ebeeae74d10a287"><span class="id" title="notation">→</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a> <a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a>),<br/>
<span class="id" title="keyword">∀</span> (<span class="id" title="var">x</span> <span class="id" title="var">y</span>: <a class="idref" href="compcert.lib.BoolEqual.html#A"><span class="id" title="variable">A</span></a>), <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">{</span></a><a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#1c39bf18749e5cc609e83c0a0ba5a372"><span class="id" title="notation">=</span></a><a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">+</span></a> <a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">{</span></a><a class="idref" href="compcert.lib.BoolEqual.html#x"><span class="id" title="variable">x</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Logic.html#32263a1c8b01baecdff9deb038955bc9"><span class="id" title="notation">≠</span></a><a class="idref" href="compcert.lib.BoolEqual.html#y"><span class="id" title="variable">y</span></a><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Specif.html#5bf2050e90b21ebc82dc5463d1ba338e"><span class="id" title="notation">}</span></a>.<br/>
<span class="id" title="keyword">Proof</span>.<br/>
<span class="id" title="tactic">intros</span>. <span class="id" title="tactic">destruct</span> (<span class="id" title="var">f</span> <span class="id" title="var">x</span> <span class="id" title="var">y</span>) <span class="id" title="var">eqn</span>:<span class="id" title="var">E</span>.<br/>
<span class="id" title="tactic">left</span>. <span class="id" title="tactic">apply</span> <span class="id" title="var">f_sound</span>. <span class="id" title="tactic">auto</span>.<br/>
<span class="id" title="tactic">right</span>; <span class="id" title="tactic">red</span>; <span class="id" title="tactic">intros</span>. <span class="id" title="tactic">subst</span> <span class="id" title="var">y</span>. <span class="id" title="tactic">rewrite</span> <span class="id" title="var">f_refl</span> <span class="id" title="keyword">in</span> <span class="id" title="var">E</span>. <span class="id" title="tactic">discriminate</span>.<br/>
<span class="id" title="keyword">Defined</span>.<br/>
<br/>
<span class="id" title="keyword">End</span> <a class="idref" href="compcert.lib.BoolEqual.html#BE"><span class="id" title="module">BE</span></a>.<br/>
<br/>
</div>
<div class="doc">
Applied to a goal of the form <span class="inlinecode"><a class="idref" href="liblayers.compcertx.ClightModules.html#InlinableFunction.t"><span class="id" title="record">t</span></a></span> <span class="inlinecode">→</span> <span class="inlinecode"><a class="idref" href="liblayers.compcertx.ClightModules.html#InlinableFunction.t"><span class="id" title="record">t</span></a></span> <span class="inlinecode">→</span> <span class="inlinecode"><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a></span>, the <span class="inlinecode"><span class="id" title="var">boolean_equality</span></span>
tactic defines a function with that type, returning <span class="inlinecode"><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#true"><span class="id" title="constructor">true</span></a></span> iff the two
arguments of type <span class="inlinecode"><a class="idref" href="liblayers.compcertx.ClightModules.html#InlinableFunction.t"><span class="id" title="record">t</span></a></span> are equal. <span class="inlinecode"><a class="idref" href="liblayers.compcertx.ClightModules.html#InlinableFunction.t"><span class="id" title="record">t</span></a></span> must be an inductive type.
For any type <span class="inlinecode"><a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.u"><span class="id" title="variable">u</span></a></span> other than <span class="inlinecode"><a class="idref" href="liblayers.compcertx.ClightModules.html#InlinableFunction.t"><span class="id" title="record">t</span></a></span> that appears in arguments of constructors
of <span class="inlinecode"><a class="idref" href="liblayers.compcertx.ClightModules.html#InlinableFunction.t"><span class="id" title="record">t</span></a></span>, a decidable equality over <span class="inlinecode"><a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.u"><span class="id" title="variable">u</span></a></span> must be provided, as an hypothesis
of type <span class="inlinecode"><span class="id" title="keyword">∀</span></span> <span class="inlinecode">(<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a></span> <span class="inlinecode"><a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>:</span> <span class="inlinecode"><a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.u"><span class="id" title="variable">u</span></a>),</span> <span class="inlinecode">{<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a>=<a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>}+{<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a>≠<a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>}</span>.
</div>
<div class="code">
<span class="id" title="keyword">Ltac</span> <span class="id" title="var">boolean_equality</span> := <span class="id" title="var">BE.bool_eq</span>.<br/>
<br/>
</div>
<div class="doc">
Given a function <span class="inlinecode"><a class="idref" href="compcert.lib.Maps.html#ITree.beq"><span class="id" title="definition">beq</span></a></span> of type <span class="inlinecode"><a class="idref" href="liblayers.compcertx.ClightModules.html#InlinableFunction.t"><span class="id" title="record">t</span></a></span> <span class="inlinecode">→</span> <span class="inlinecode"><a class="idref" href="liblayers.compcertx.ClightModules.html#InlinableFunction.t"><span class="id" title="record">t</span></a></span> <span class="inlinecode">→</span> <span class="inlinecode"><a class="idref" href="http://coq.inria.fr/distrib/8.6/stdlib/Coq.Init.Datatypes.html#bool"><span class="id" title="inductive">bool</span></a></span> produced by <span class="inlinecode"><span class="id" title="var">boolean_equality</span></span>,
the <span class="inlinecode"><span class="id" title="var">decidable_equality_from</span></span> <span class="inlinecode"><a class="idref" href="compcert.lib.Maps.html#ITree.beq"><span class="id" title="definition">beq</span></a></span> produces a decidable equality with type
<span class="inlinecode"><span class="id" title="keyword">∀</span></span> <span class="inlinecode">(<a class="idref" href="compcert.flocq.Appli.Fappli_rnd_odd.html#Odd_prop_aux.x"><span class="id" title="variable">x</span></a></span> <span class="inlinecode"><a class="idref" href="compcert.lib.Coqlib.html#y"><span class="id" title="variable">y</span></a>:</span> <span class="inlinecode"><a class="idref" href="liblayers.compcertx.ClightModules.html#InlinableFunction.t"><span class="id" title="record">t</span></a></span>, {x=y}+{x<>y}.
</div>
<div class="code">
<br/>
<span class="id" title="keyword">Ltac</span> <span class="id" title="var">decidable_equality_from</span> <span class="id" title="var">beq</span> :=<br/>
<span class="id" title="tactic">apply</span> (<a class="idref" href="compcert.lib.BoolEqual.html#dec_eq_from_bool_eq"><span class="id" title="lemma">BE.dec_eq_from_bool_eq</span></a> <span class="id" title="var">_</span> <span class="id" title="var">beq</span>); [<span class="id" title="tactic">abstract</span> <span class="id" title="var">BE.bool_eq_refl</span>|<span class="id" title="tactic">abstract</span> <span class="id" title="var">BE.bool_eq_sound</span>].<br/>
</div>
</div>
<div id="footer">
<hr/><a href="index.html">Index</a><hr/>This page has been generated by <a href="http://coq.inria.fr/">coqdoc</a>
</div>
</div>
</body>
</html>