-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathCombi.Basic.combclass.html
More file actions
350 lines (258 loc) · 58.2 KB
/
Copy pathCombi.Basic.combclass.html
File metadata and controls
350 lines (258 loc) · 58.2 KB
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<!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=iso-8859-1" />
<link href="coqdoc.css" rel="stylesheet" type="text/css" />
<title>Combi.Basic.combclass: Fintypes for Combinatorics</title>
</head>
<body>
<div id="page">
<div id="header">
</div>
<div id="main">
<h1 class="libtitle">Library Combi.Basic.combclass: Fintypes for Combinatorics</h1>
<div class="code">
</div>
<div class="doc">
</div>
<div class="code">
</div>
<div class="doc">
<a id="lab229"></a><h1 class="section">Fintypes for Combinatorics</h1>
<div class="paragraph"> </div>
The goal of this file is to define various way to easily build finite
subtype of a countable type knowing a lists of its elements. We provide four
ways, three from a list (see <span class="inlinecode"><span class="id" title="var">sub_subFinType</span></span>, <span class="inlinecode"><span class="id" title="var">sub_uniq_subFinType</span></span> and
<span class="inlinecode"><span class="id" title="var">sub_undup_subFinType</span></span> below) and one by taking the disjoint union of already
constructed subfintypes (see <span class="inlinecode"><span class="id" title="var">union_subFinType</span></span> below).
</div>
<div class="code">
<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">HB</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <span class="id" title="library">structures</span>.<br/>
<span class="id" title="keyword">From</span> <span class="id" title="var">mathcomp</span> <span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <span class="id" title="library">all_boot</span>.<br/>
<span class="id" title="keyword">Require</span> <span class="id" title="keyword">Import</span> <a class="idref" href="Combi.SSRcomplements.tools.html#"><span class="id" title="library">tools</span></a>.<br/>
<br/>
<span class="id" title="keyword">Set Implicit Arguments</span>.<br/>
<br/>
</div>
<div class="doc">
Summing <span class="inlinecode"><span class="id" title="var">count_mem</span></span> in a <span class="inlinecode"><span class="id" title="var">finType</span></span>
</div>
<div class="code">
<span class="id" title="keyword">Lemma</span> <a id="sum_count_mem" class="idref" href="#sum_count_mem"><span class="id" title="lemma">sum_count_mem</span></a> (<a id="T:1" class="idref" href="#T:1"><span class="id" title="binder">T</span></a> : <span class="id" title="abbreviation">finType</span>) (<a id="P:2" class="idref" href="#P:2"><span class="id" title="binder">P</span></a> : <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#pred"><span class="id" title="definition">pred</span></a> <a class="idref" href="Combi.Basic.combclass.html#T:1"><span class="id" title="variable">T</span></a>) <a id="l:3" class="idref" href="#l:3"><span class="id" title="binder">l</span></a> :<br/>
<span class="id" title="notation">\</span><span class="id" title="notation">sum_</span><span class="id" title="notation">(</span><a id="i:4" class="idref" href="#i:4"><span class="id" title="binder"><span id="i:5" class="id"><span id="i:6" class="id">i</span></span></span></a> <span class="id" title="notation">|</span> <a class="idref" href="Combi.Basic.combclass.html#P:2"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#i:4"><span class="id" title="variable">i</span></a><span class="id" title="notation">)</span> (<span class="id" title="abbreviation">count_mem</span> <a class="idref" href="Combi.Basic.combclass.html#i:4"><span class="id" title="variable">i</span></a>) <a class="idref" href="Combi.Basic.combclass.html#l:3"><span class="id" title="variable">l</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="definition">count</span> <a class="idref" href="Combi.Basic.combclass.html#P:2"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#l:3"><span class="id" title="variable">l</span></a>.<br/>
<br/>
</div>
<div class="doc">
<a id="lab230"></a><h1 class="section">Building subtype from a sequence</h1>
<div class="paragraph"> </div>
Here is how to construct a fintype from a list: we are given
<ul class="doclist">
<li> a type <span class="inlinecode"><span class="id" title="var">T</span></span> which is a <span class="inlinecode"><span class="id" title="var">countType</span></span>
</li>
<li> a type <span class="inlinecode"><span class="id" title="var">TP</span></span> which is <span class="inlinecode"><span class="id" title="var">subCountType</span></span> of <span class="inlinecode"><span class="id" title="var">T</span></span> for a predicate <span class="inlinecode"><span class="id" title="var">P</span></span>.
</li>
<li> a list <span class="inlinecode"><span class="id" title="var">lst</span></span> of element from <span class="inlinecode"><span class="id" title="var">T</span></span> whose element veryfies the predicate <span class="inlinecode"><span class="id" title="var">P</span></span>.
</li>
</ul>
<div class="paragraph"> </div>
We define three possible ways to provide <span class="inlinecode"><span class="id" title="var">TP</span></span> with a <span class="inlinecode"><span class="id" title="var">subFinType</span></span> structure:
<ul class="doclist">
<li> <span class="inlinecode"><span class="id" title="var">sub_subFinType</span></span> which suppose that any element verifying <span class="inlinecode"><span class="id" title="var">P</span></span> appears only
once in <span class="inlinecode"><span class="id" title="var">lst</span></span>;
</li>
<li> <span class="inlinecode"><span class="id" title="var">sub_uniq_subFinType</span></span> which suppose that any element verifying <span class="inlinecode"><span class="id" title="var">P</span></span> appears in
<span class="inlinecode"><span class="id" title="var">lst</span></span> and that <span class="inlinecode"><span class="id" title="var">lst</span></span> is duplicate free (<span class="inlinecode"><span class="id" title="var">uniq</span></span>);
</li>
<li> <span class="inlinecode"><span class="id" title="var">sub_undup_subFinType</span></span> which suppose that any element verifying <span class="inlinecode"><span class="id" title="var">P</span></span> appears in
<span class="inlinecode"><span class="id" title="var">lst</span></span> and remove the duplicate elements.
</li>
</ul>
</div>
<div class="code">
<br/>
<span class="id" title="keyword">Section</span> <a id="EnumFintype" class="idref" href="#EnumFintype"><span class="id" title="section">EnumFintype</span></a>.<br/>
<span class="id" title="keyword">Context</span> {<a id="EnumFintype.T" class="idref" href="#EnumFintype.T"><span class="id" title="variable">T</span></a> : <span class="id" title="abbreviation">countType</span>} {<a id="EnumFintype.P" class="idref" href="#EnumFintype.P"><span class="id" title="variable">P</span></a> : <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#pred"><span class="id" title="definition">pred</span></a> <a class="idref" href="Combi.Basic.combclass.html#T:7"><span class="id" title="variable">T</span></a>} (<a id="EnumFintype.TP" class="idref" href="#EnumFintype.TP"><span class="id" title="variable">TP</span></a> : <span class="id" title="abbreviation">subCountType</span> <a class="idref" href="Combi.Basic.combclass.html#P:8"><span class="id" title="variable">P</span></a>).<br/>
<span class="id" title="keyword">Variable</span> <a id="EnumFintype.subenum" class="idref" href="#EnumFintype.subenum"><span class="id" title="variable">subenum</span></a> : <span class="id" title="abbreviation">seq</span> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.T"><span class="id" title="variable">T</span></a>.<br/>
<span class="id" title="keyword">Hypothesis</span> <a id="EnumFintype.subenumP" class="idref" href="#EnumFintype.subenumP"><span class="id" title="variable">subenumP</span></a> : <span class="id" title="definition">all</span> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.P"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<span class="id" title="keyword">Hypothesis</span> <a id="EnumFintype.subenum_countE" class="idref" href="#EnumFintype.subenum_countE"><span class="id" title="variable">subenum_countE</span></a> : <span class="id" title="keyword">forall</span> <a id="x:14" class="idref" href="#x:14"><span class="id" title="binder">x</span></a> : <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.T"><span class="id" title="variable">T</span></a>, <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.P"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#x:14"><span class="id" title="variable">x</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#::type_scope:x_'->'_x"><span class="id" title="notation">-></span></a> <span class="id" title="abbreviation">count_mem</span> <a class="idref" href="Combi.Basic.combclass.html#x:14"><span class="id" title="variable">x</span></a> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.subenum"><span class="id" title="variable">subenum</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> 1.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="sub_enumE" class="idref" href="#sub_enumE"><span class="id" title="lemma">sub_enumE</span></a> : <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.subenum"><span class="id" title="variable">subenum</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#1e6a438ff685c38fcd9034a94f271777"><span class="id" title="notation">=</span></a><a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#1e6a438ff685c38fcd9034a94f271777"><span class="id" title="notation">i</span></a> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.P"><span class="id" title="variable">P</span></a>.<br/>
<br/>
<span class="id" title="keyword">Definition</span> <a id="subType_seq" class="idref" href="#subType_seq"><span class="id" title="definition">subType_seq</span></a> : <span class="id" title="abbreviation">seq</span> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.TP"><span class="id" title="variable">TP</span></a> := <span class="id" title="definition">pmap</span> <span class="id" title="definition">insub</span> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="subType_seqP" class="idref" href="#subType_seqP"><span class="id" title="lemma">subType_seqP</span></a> : <span class="id" title="definition">map</span> <span class="id" title="abbreviation">val</span> <a class="idref" href="Combi.Basic.combclass.html#subType_seq"><span class="id" title="definition">subType_seq</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="finite_subP" class="idref" href="#finite_subP"><span class="id" title="lemma">finite_subP</span></a> : <span class="id" title="abbreviation">Finite.axiom</span> <a class="idref" href="Combi.Basic.combclass.html#subType_seq"><span class="id" title="definition">subType_seq</span></a>.<br/>
<span class="id" title="keyword">Definition</span> <a id="seq_finType" class="idref" href="#seq_finType"><span class="id" title="definition">seq_finType</span></a> : <span class="id" title="abbreviation">finType</span> :=<br/>
<span class="id" title="var">HB.pack</span> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.TP"><span class="id" title="variable">TP</span></a> (<span class="id" title="abbreviation">isFinite.Build</span> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.TP"><span class="id" title="variable">TP</span></a> <a class="idref" href="Combi.Basic.combclass.html#finite_subP"><span class="id" title="lemma">finite_subP</span></a>).<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="enum_subE" class="idref" href="#enum_subE"><span class="id" title="lemma">enum_subE</span></a> : <span class="id" title="definition">map</span> <span class="id" title="abbreviation">val</span> (<span class="id" title="abbreviation">enum</span> (<a class="idref" href="Combi.Basic.combclass.html#seq_finType"><span class="id" title="definition">seq_finType</span></a>)) <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="card_subE" class="idref" href="#card_subE"><span class="id" title="lemma">card_subE</span></a> : <span class="id" title="notation">#|</span><a class="idref" href="Combi.Basic.combclass.html#seq_finType"><span class="id" title="definition">seq_finType</span></a><span class="id" title="notation">|</span> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="definition">size</span> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<br/>
<span class="id" title="keyword">End</span> <a class="idref" href="Combi.Basic.combclass.html#EnumFintype"><span class="id" title="section">EnumFintype</span></a>.<br/>
<br/>
<span class="id" title="keyword">Module</span> <a id="Example1" class="idref" href="#Example1"><span class="id" title="module">Example1</span></a>.<br/>
<br/>
<span class="id" title="keyword">Definition</span> <a id="Example1.is_one" class="idref" href="#Example1.is_one"><span class="id" title="definition">is_one</span></a> <a id="n:17" class="idref" href="#n:17"><span class="id" title="binder">n</span></a> := <a class="idref" href="Combi.Basic.combclass.html#n:17"><span class="id" title="variable">n</span></a> <span class="id" title="notation">==</span> 1.<br/>
<span class="id" title="keyword">Record</span> <a id="Example1.isOne" class="idref" href="#Example1.isOne"><span class="id" title="record">isOne</span></a> := <span class="id" title="var">IsOne</span> { <a id="Example1.one" class="idref" href="#Example1.one"><span class="id" title="projection">one</span></a> :> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>; <span class="id" title="var">_</span> : <a class="idref" href="Combi.Basic.combclass.html#Example1.is_one"><span class="id" title="definition">is_one</span></a> <a class="idref" href="Combi.Basic.combclass.html#one:19"><span class="id" title="method">one</span></a>}.<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example1.all_isOne" class="idref" href="#Example1.all_isOne"><span class="id" title="lemma">all_isOne</span></a> : <span class="id" title="definition">all</span> <a class="idref" href="Combi.Basic.combclass.html#Example1.is_one"><span class="id" title="definition">is_one</span></a> <span class="id" title="notation">[::</span> 1<span class="id" title="notation">]</span>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example1.isOne_count_1" class="idref" href="#Example1.isOne_count_1"><span class="id" title="lemma">isOne_count_1</span></a> <a id="x:20" class="idref" href="#x:20"><span class="id" title="binder">x</span></a> : <a class="idref" href="Combi.Basic.combclass.html#Example1.is_one"><span class="id" title="definition">is_one</span></a> <a class="idref" href="Combi.Basic.combclass.html#x:20"><span class="id" title="variable">x</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#::type_scope:x_'->'_x"><span class="id" title="notation">-></span></a> <span class="id" title="abbreviation">count_mem</span> <a class="idref" href="Combi.Basic.combclass.html#x:20"><span class="id" title="variable">x</span></a> <span class="id" title="notation">[::</span> 1<span class="id" title="notation">]</span> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> 1.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example1.enum_isOne" class="idref" href="#Example1.enum_isOne"><span class="id" title="lemma">enum_isOne</span></a> : <span class="id" title="definition">map</span> <span class="id" title="abbreviation">val</span> (<span class="id" title="abbreviation">enum</span> (<a class="idref" href="Combi.Basic.combclass.html#Example1.isOne"><span class="id" title="record">isOne</span></a> : <span class="id" title="abbreviation">finType</span>)) <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">[::</span> 1<span class="id" title="notation">]</span>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example1.card_isOne" class="idref" href="#Example1.card_isOne"><span class="id" title="lemma">card_isOne</span></a> : <span class="id" title="notation">#|</span><a class="idref" href="Combi.Basic.combclass.html#Example1.isOne"><span class="id" title="record">isOne</span></a> : <span class="id" title="abbreviation">finType</span><span class="id" title="notation">|</span> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> 1.<br/>
<br/>
<span class="id" title="keyword">End</span> <a class="idref" href="Combi.Basic.combclass.html#Example1"><span class="id" title="module">Example1</span></a>.<br/>
<br/>
</div>
<div class="doc">
<a id="lab231"></a><h2 class="section">Method 2 - Each element appears and the lists is uniq</h2>
</div>
<div class="code">
<span class="id" title="keyword">Section</span> <a id="UniqFinType" class="idref" href="#UniqFinType"><span class="id" title="section">UniqFinType</span></a>.<br/>
<span class="id" title="keyword">Context</span> {<a id="UniqFinType.T" class="idref" href="#UniqFinType.T"><span class="id" title="variable">T</span></a> : <span class="id" title="abbreviation">countType</span>} {<a id="UniqFinType.P" class="idref" href="#UniqFinType.P"><span class="id" title="variable">P</span></a> : <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#pred"><span class="id" title="definition">pred</span></a> <a class="idref" href="Combi.Basic.combclass.html#T:21"><span class="id" title="variable">T</span></a>} (<a id="UniqFinType.TP" class="idref" href="#UniqFinType.TP"><span class="id" title="variable">TP</span></a> : <span class="id" title="abbreviation">subCountType</span> <a class="idref" href="Combi.Basic.combclass.html#P:22"><span class="id" title="variable">P</span></a>).<br/>
<span class="id" title="keyword">Variable</span> <a id="UniqFinType.subenum" class="idref" href="#UniqFinType.subenum"><span class="id" title="variable">subenum</span></a> : <span class="id" title="abbreviation">seq</span> <a class="idref" href="Combi.Basic.combclass.html#UniqFinType.T"><span class="id" title="variable">T</span></a>.<br/>
<span class="id" title="keyword">Hypothesis</span> <a id="UniqFinType.subenumE" class="idref" href="#UniqFinType.subenumE"><span class="id" title="variable">subenumE</span></a> : <a class="idref" href="Combi.Basic.combclass.html#UniqFinType.subenum"><span class="id" title="variable">subenum</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#1e6a438ff685c38fcd9034a94f271777"><span class="id" title="notation">=</span></a><a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#1e6a438ff685c38fcd9034a94f271777"><span class="id" title="notation">i</span></a> <a class="idref" href="Combi.Basic.combclass.html#UniqFinType.P"><span class="id" title="variable">P</span></a>.<br/>
<span class="id" title="keyword">Hypothesis</span> <a id="UniqFinType.subenum_uniq" class="idref" href="#UniqFinType.subenum_uniq"><span class="id" title="variable">subenum_uniq</span></a> : <span class="id" title="definition">uniq</span> <a class="idref" href="Combi.Basic.combclass.html#UniqFinType.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="all_subenum" class="idref" href="#all_subenum"><span class="id" title="lemma">all_subenum</span></a> : <span class="id" title="definition">all</span> <a class="idref" href="Combi.Basic.combclass.html#UniqFinType.P"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#UniqFinType.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="subenum_countE" class="idref" href="#subenum_countE"><span class="id" title="lemma">subenum_countE</span></a> <a id="x:30" class="idref" href="#x:30"><span class="id" title="binder">x</span></a> : <a class="idref" href="Combi.Basic.combclass.html#UniqFinType.P"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#x:30"><span class="id" title="variable">x</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#::type_scope:x_'->'_x"><span class="id" title="notation">-></span></a> <span class="id" title="abbreviation">count_mem</span> <a class="idref" href="Combi.Basic.combclass.html#x:30"><span class="id" title="variable">x</span></a> <a class="idref" href="Combi.Basic.combclass.html#UniqFinType.subenum"><span class="id" title="variable">subenum</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> 1.<br/>
<span class="id" title="keyword">Definition</span> <a id="uniq_finType" class="idref" href="#uniq_finType"><span class="id" title="definition">uniq_finType</span></a> : <span class="id" title="abbreviation">finType</span> :=<br/>
<a class="idref" href="Combi.Basic.combclass.html#seq_finType"><span class="id" title="definition">seq_finType</span></a> <a class="idref" href="Combi.Basic.combclass.html#UniqFinType.TP"><span class="id" title="variable">TP</span></a> <a class="idref" href="Combi.Basic.combclass.html#all_subenum"><span class="id" title="lemma">all_subenum</span></a> <a class="idref" href="Combi.Basic.combclass.html#subenum_countE"><span class="id" title="lemma">subenum_countE</span></a>.<br/>
<span class="id" title="keyword">End</span> <a class="idref" href="Combi.Basic.combclass.html#UniqFinType"><span class="id" title="section">UniqFinType</span></a>.<br/>
<br/>
<span class="id" title="keyword">Module</span> <a id="Example2" class="idref" href="#Example2"><span class="id" title="module">Example2</span></a>.<br/>
<br/>
<span class="id" title="keyword">Definition</span> <a id="Example2.is_one" class="idref" href="#Example2.is_one"><span class="id" title="definition">is_one</span></a> <a id="n:31" class="idref" href="#n:31"><span class="id" title="binder">n</span></a> := <a class="idref" href="Combi.Basic.combclass.html#n:31"><span class="id" title="variable">n</span></a> <span class="id" title="notation">==</span> 1.<br/>
<span class="id" title="keyword">Record</span> <a id="Example2.isOne" class="idref" href="#Example2.isOne"><span class="id" title="record">isOne</span></a> := <span class="id" title="var">IsOne</span> { <a id="Example2.one" class="idref" href="#Example2.one"><span class="id" title="projection">one</span></a> :> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>; <span class="id" title="var">_</span> : <a class="idref" href="Combi.Basic.combclass.html#Example2.is_one"><span class="id" title="definition">is_one</span></a> <a class="idref" href="Combi.Basic.combclass.html#one:33"><span class="id" title="method">one</span></a>}.<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example2.all_isoneE" class="idref" href="#Example2.all_isoneE"><span class="id" title="lemma">all_isoneE</span></a> : <span class="id" title="notation">[::</span> 1<span class="id" title="notation">]</span> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#1e6a438ff685c38fcd9034a94f271777"><span class="id" title="notation">=</span></a><a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#1e6a438ff685c38fcd9034a94f271777"><span class="id" title="notation">i</span></a> <a class="idref" href="Combi.Basic.combclass.html#Example2.is_one"><span class="id" title="definition">is_one</span></a>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example2.isOne_uniq" class="idref" href="#Example2.isOne_uniq"><span class="id" title="lemma">isOne_uniq</span></a> : <span class="id" title="definition">uniq</span> <span class="id" title="notation">[::</span> 1<span class="id" title="notation">]</span>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example2.enum_isOne" class="idref" href="#Example2.enum_isOne"><span class="id" title="lemma">enum_isOne</span></a> : <span class="id" title="definition">map</span> <span class="id" title="abbreviation">val</span> (<span class="id" title="abbreviation">enum</span> (<a class="idref" href="Combi.Basic.combclass.html#Example2.isOne"><span class="id" title="record">isOne</span></a> : <span class="id" title="abbreviation">finType</span>)) <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">[::</span> 1<span class="id" title="notation">]</span>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example2.card_isOne" class="idref" href="#Example2.card_isOne"><span class="id" title="lemma">card_isOne</span></a> : <span class="id" title="notation">#|</span><a class="idref" href="Combi.Basic.combclass.html#Example2.isOne"><span class="id" title="record">isOne</span></a> : <span class="id" title="abbreviation">finType</span><span class="id" title="notation">|</span> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> 1.<br/>
<br/>
<span class="id" title="keyword">End</span> <a class="idref" href="Combi.Basic.combclass.html#Example2"><span class="id" title="module">Example2</span></a>.<br/>
<br/>
</div>
<div class="doc">
<a id="lab232"></a><h2 class="section">Method 3 - Each element appears, we remove the duplicates</h2>
</div>
<div class="code">
<span class="id" title="keyword">Section</span> <a id="SubUndup" class="idref" href="#SubUndup"><span class="id" title="section">SubUndup</span></a>.<br/>
<span class="id" title="keyword">Context</span> {<a id="SubUndup.T" class="idref" href="#SubUndup.T"><span class="id" title="variable">T</span></a> : <span class="id" title="abbreviation">countType</span>} {<a id="SubUndup.P" class="idref" href="#SubUndup.P"><span class="id" title="variable">P</span></a> : <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#pred"><span class="id" title="definition">pred</span></a> <a class="idref" href="Combi.Basic.combclass.html#T:34"><span class="id" title="variable">T</span></a>} (<a id="SubUndup.TP" class="idref" href="#SubUndup.TP"><span class="id" title="variable">TP</span></a> : <span class="id" title="abbreviation">subCountType</span> <a class="idref" href="Combi.Basic.combclass.html#P:35"><span class="id" title="variable">P</span></a>).<br/>
<span class="id" title="keyword">Variable</span> <a id="SubUndup.subenum" class="idref" href="#SubUndup.subenum"><span class="id" title="variable">subenum</span></a> : <span class="id" title="abbreviation">seq</span> <a class="idref" href="Combi.Basic.combclass.html#SubUndup.T"><span class="id" title="variable">T</span></a>.<br/>
<span class="id" title="keyword">Hypothesis</span> <a id="SubUndup.subenumP" class="idref" href="#SubUndup.subenumP"><span class="id" title="variable">subenumP</span></a> : <span class="id" title="definition">all</span> <a class="idref" href="Combi.Basic.combclass.html#SubUndup.P"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubUndup.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<span class="id" title="keyword">Hypothesis</span> <a id="SubUndup.subenum_in" class="idref" href="#SubUndup.subenum_in"><span class="id" title="variable">subenum_in</span></a> : <span class="id" title="keyword">forall</span> <a id="x:41" class="idref" href="#x:41"><span class="id" title="binder">x</span></a> : <a class="idref" href="Combi.Basic.combclass.html#SubUndup.T"><span class="id" title="variable">T</span></a>, <a class="idref" href="Combi.Basic.combclass.html#SubUndup.P"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#x:41"><span class="id" title="variable">x</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#::type_scope:x_'->'_x"><span class="id" title="notation">-></span></a> <a class="idref" href="Combi.Basic.combclass.html#x:41"><span class="id" title="variable">x</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#b09457274bcb94927e289b8a9e9cd3f7"><span class="id" title="notation">\</span></a><a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#b09457274bcb94927e289b8a9e9cd3f7"><span class="id" title="notation">in</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubUndup.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="finite_sub_undupP" class="idref" href="#finite_sub_undupP"><span class="id" title="lemma">finite_sub_undupP</span></a> :<br/>
<span class="id" title="abbreviation">Finite.axiom</span> (<span class="id" title="definition">undup</span> (<a class="idref" href="Combi.Basic.combclass.html#subType_seq"><span class="id" title="definition">subType_seq</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubUndup.TP"><span class="id" title="variable">TP</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubUndup.subenum"><span class="id" title="variable">subenum</span></a>)).<br/>
<span class="id" title="keyword">Definition</span> <a id="undup_finType" class="idref" href="#undup_finType"><span class="id" title="definition">undup_finType</span></a> : <span class="id" title="abbreviation">finType</span> :=<br/>
<span class="id" title="var">HB.pack</span> <a class="idref" href="Combi.Basic.combclass.html#SubUndup.TP"><span class="id" title="variable">TP</span></a> (<span class="id" title="abbreviation">isFinite.Build</span> <a class="idref" href="Combi.Basic.combclass.html#SubUndup.TP"><span class="id" title="variable">TP</span></a> <a class="idref" href="Combi.Basic.combclass.html#finite_sub_undupP"><span class="id" title="lemma">finite_sub_undupP</span></a>).<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="enum_sub_undupE" class="idref" href="#enum_sub_undupE"><span class="id" title="lemma">enum_sub_undupE</span></a> : <span class="id" title="definition">map</span> <span class="id" title="abbreviation">val</span> (<span class="id" title="abbreviation">enum</span> <a class="idref" href="Combi.Basic.combclass.html#undup_finType"><span class="id" title="definition">undup_finType</span></a>) <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="definition">undup</span> <a class="idref" href="Combi.Basic.combclass.html#SubUndup.subenum"><span class="id" title="variable">subenum</span></a>.<br/>
<br/>
<span class="id" title="keyword">End</span> <a class="idref" href="Combi.Basic.combclass.html#SubUndup"><span class="id" title="section">SubUndup</span></a>.<br/>
<br/>
<span class="id" title="keyword">Module</span> <a id="Example3" class="idref" href="#Example3"><span class="id" title="module">Example3</span></a>.<br/>
<br/>
<span class="id" title="keyword">Definition</span> <a id="Example3.is_one" class="idref" href="#Example3.is_one"><span class="id" title="definition">is_one</span></a> <a id="n:44" class="idref" href="#n:44"><span class="id" title="binder">n</span></a> := <a class="idref" href="Combi.Basic.combclass.html#n:44"><span class="id" title="variable">n</span></a> <span class="id" title="notation">==</span> 1.<br/>
<span class="id" title="keyword">Record</span> <a id="Example3.isOne" class="idref" href="#Example3.isOne"><span class="id" title="record">isOne</span></a> := <span class="id" title="var">IsOne</span> { <a id="Example3.one" class="idref" href="#Example3.one"><span class="id" title="projection">one</span></a> :> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Datatypes.html#nat"><span class="id" title="inductive">nat</span></a>; <span class="id" title="var">_</span> : <a class="idref" href="Combi.Basic.combclass.html#Example3.is_one"><span class="id" title="definition">is_one</span></a> <a class="idref" href="Combi.Basic.combclass.html#one:46"><span class="id" title="method">one</span></a>}.<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example3.all_isOne" class="idref" href="#Example3.all_isOne"><span class="id" title="lemma">all_isOne</span></a> : <span class="id" title="definition">all</span> <a class="idref" href="Combi.Basic.combclass.html#Example3.is_one"><span class="id" title="definition">is_one</span></a> <span class="id" title="notation">[::</span> 1<span class="id" title="notation">;</span> 1<span class="id" title="notation">]</span>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example3.isOne_in" class="idref" href="#Example3.isOne_in"><span class="id" title="lemma">isOne_in</span></a> <a id="n:47" class="idref" href="#n:47"><span class="id" title="binder">n</span></a> : <a class="idref" href="Combi.Basic.combclass.html#Example3.is_one"><span class="id" title="definition">is_one</span></a> <a class="idref" href="Combi.Basic.combclass.html#n:47"><span class="id" title="variable">n</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#::type_scope:x_'->'_x"><span class="id" title="notation">-></span></a> <a class="idref" href="Combi.Basic.combclass.html#n:47"><span class="id" title="variable">n</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#b09457274bcb94927e289b8a9e9cd3f7"><span class="id" title="notation">\</span></a><a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#b09457274bcb94927e289b8a9e9cd3f7"><span class="id" title="notation">in</span></a> <span class="id" title="notation">[::</span> 1<span class="id" title="notation">;</span> 1<span class="id" title="notation">]</span>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example3.enum_isOne" class="idref" href="#Example3.enum_isOne"><span class="id" title="lemma">enum_isOne</span></a> : <span class="id" title="definition">map</span> <span class="id" title="abbreviation">val</span> (<span class="id" title="abbreviation">enum</span> (<a class="idref" href="Combi.Basic.combclass.html#Example3.isOne"><span class="id" title="record">isOne</span></a> : <span class="id" title="abbreviation">finType</span>)) <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">[::</span> 1<span class="id" title="notation">]</span>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="Example3.card_isOne" class="idref" href="#Example3.card_isOne"><span class="id" title="lemma">card_isOne</span></a> : <span class="id" title="notation">#|</span><a class="idref" href="Combi.Basic.combclass.html#Example3.isOne"><span class="id" title="record">isOne</span></a> : <span class="id" title="abbreviation">finType</span><span class="id" title="notation">|</span> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> 1.<br/>
<br/>
<span class="id" title="keyword">End</span> <a class="idref" href="Combi.Basic.combclass.html#Example3"><span class="id" title="module">Example3</span></a>.<br/>
<br/>
</div>
<div class="doc">
<a id="lab233"></a><h1 class="section">Finite subtype obtained as a finite the dijoint union of finite subtypes</h1>
<div class="paragraph"> </div>
Here is how to construct a union of disjoint finite subtype of a countable
type. More precisely, we want to define a type for
<div class="paragraph"> </div>
<code>U := Union_(i : TI | Pi i) TPi i</code>
<div class="paragraph"> </div>
For the constructed type <span class="inlinecode"><span class="id" title="var">U</span></span>, we need the following data:
<ul class="doclist">
<li> a type <span class="inlinecode"><span class="id" title="var">T</span></span> which is a <span class="inlinecode"><span class="id" title="var">countType</span></span>.
</li>
<li> a type <span class="inlinecode"><span class="id" title="var">TP</span></span> which is <span class="inlinecode"><span class="id" title="var">subCountType</span></span> of <span class="inlinecode"><span class="id" title="var">T</span></span> for a predicate <span class="inlinecode"><span class="id" title="var">P</span></span>.
</li>
</ul>
The index type must be also countable, it should be given by
<ul class="doclist">
<li> a type <span class="inlinecode"><span class="id" title="var">TI</span></span> which is a <span class="inlinecode"><span class="id" title="var">countType</span></span>.
</li>
<li> a type <span class="inlinecode"><span class="id" title="var">TPI</span></span> which is <span class="inlinecode"><span class="id" title="var">subCountType</span></span> of <span class="inlinecode"><span class="id" title="var">TI</span></span> for a predicate <span class="inlinecode"><span class="id" title="var">PI</span></span>.
</li>
</ul>
For all index <span class="inlinecode"><span class="id" title="var">i</span></span> <span class="inlinecode">:</span> <span class="inlinecode"><span class="id" title="var">TPI</span></span>, there must be a finite type, given by
<ul class="doclist">
<li> a type <span class="inlinecode"><span class="id" title="var">TPi</span></span> <span class="inlinecode"><span class="id" title="var">i</span></span> which is a <span class="inlinecode"><span class="id" title="var">subFinType</span></span> <span class="inlinecode">(<span class="id" title="var">Pi</span></span> <span class="inlinecode">(<span class="id" title="var">val</span></span> <span class="inlinecode"><span class="id" title="var">i</span>))</span> for a predicate <span class="inlinecode"><span class="id" title="var">Pi</span></span> <span class="inlinecode"><span class="id" title="var">i</span></span>.
</li>
</ul>
Finally the sets <code>{ { x | Pi i } | PI i }</code> should define a partition
of <code>{ x | P x }</code>. This is ensured by providing
<ul class="doclist">
<li> a map <span class="inlinecode"><span class="id" title="var">FI</span></span> <span class="inlinecode">:</span> <span class="inlinecode"><span class="id" title="var">T</span></span> <span class="inlinecode">-></span> <span class="inlinecode"><span class="id" title="var">TI</span></span> which recover the index of an element <span class="inlinecode"><span class="id" title="var">x</span></span> of <span class="inlinecode"><span class="id" title="var">T</span></span>.
</li>
</ul>
Together with the two following requirements:
<ul class="doclist">
<li> for all index <span class="inlinecode"><span class="id" title="var">i</span></span> <span class="inlinecode">:</span> <span class="inlinecode"><span class="id" title="var">TPi</span></span> and <span class="inlinecode"><span class="id" title="var">x</span></span> <span class="inlinecode">:</span> <span class="inlinecode"><span class="id" title="var">T</span></span>, the statement <span class="inlinecode"><span class="id" title="var">Pi</span></span> <span class="inlinecode"><span class="id" title="var">i</span></span> <span class="inlinecode"><span class="id" title="var">x</span></span> must be
equivalent to <span class="inlinecode"><span class="id" title="var">P</span></span> <span class="inlinecode"><span class="id" title="var">x</span></span> <span class="inlinecode">&&</span> <span class="inlinecode"><span class="id" title="var">i</span></span> <span class="inlinecode">==</span> <span class="inlinecode"><span class="id" title="var">FI</span></span> <span class="inlinecode"><span class="id" title="var">x</span></span>.
</li>
<li> forall <span class="inlinecode"><span class="id" title="var">x</span></span> <span class="inlinecode">:</span> <span class="inlinecode"><span class="id" title="var">T</span></span>, such that <span class="inlinecode"><span class="id" title="var">P</span></span> <span class="inlinecode"><span class="id" title="var">x</span></span> the assertion <span class="inlinecode"><span class="id" title="var">PI</span></span> <span class="inlinecode">(<span class="id" title="var">FI</span></span> <span class="inlinecode"><span class="id" title="var">x</span>)</span> must holds.
</li>
</ul>
From all these data <span class="inlinecode"><span class="id" title="var">union_subFinType</span></span> is a <span class="inlinecode"><span class="id" title="var">subFinType</span></span> of <span class="inlinecode"><span class="id" title="var">T</span></span> for the
predicate <span class="inlinecode"><span class="id" title="var">P</span></span> that is a <span class="inlinecode"><span class="id" title="var">subFinType</span></span> structure for <span class="inlinecode"><span class="id" title="var">TP</span></span>.
<div class="paragraph"> </div>
See <span class="inlinecode"><span class="id" title="var">stpn_subFinType</span></span> and <span class="inlinecode"><span class="id" title="var">yamn_subFinType</span></span> for example of usage.
</div>
<div class="code">
<span class="id" title="keyword">Section</span> <a id="SubtypesDisjointUnion" class="idref" href="#SubtypesDisjointUnion"><span class="id" title="section">SubtypesDisjointUnion</span></a>.<br/>
<br/>
<span class="id" title="keyword">Variable</span> <a id="SubtypesDisjointUnion.T" class="idref" href="#SubtypesDisjointUnion.T"><span class="id" title="variable">T</span></a> : <span class="id" title="abbreviation">countType</span>.<br/>
<span class="id" title="keyword">Variable</span> <a id="SubtypesDisjointUnion.P" class="idref" href="#SubtypesDisjointUnion.P"><span class="id" title="variable">P</span></a> : <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#pred"><span class="id" title="definition">pred</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.T"><span class="id" title="variable">T</span></a>.<br/>
<span class="id" title="keyword">Variable</span> <a id="SubtypesDisjointUnion.TP" class="idref" href="#SubtypesDisjointUnion.TP"><span class="id" title="variable">TP</span></a> : <span class="id" title="abbreviation">subCountType</span> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.P"><span class="id" title="variable">P</span></a>.<br/>
<br/>
<span class="id" title="keyword">Variable</span> <a id="SubtypesDisjointUnion.TI" class="idref" href="#SubtypesDisjointUnion.TI"><span class="id" title="variable">TI</span></a> : <span class="id" title="abbreviation">countType</span>.<br/>
<span class="id" title="keyword">Variable</span> <a id="SubtypesDisjointUnion.PI" class="idref" href="#SubtypesDisjointUnion.PI"><span class="id" title="variable">PI</span></a> : <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#pred"><span class="id" title="definition">pred</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TI"><span class="id" title="variable">TI</span></a>.<br/>
<span class="id" title="keyword">Variable</span> <a id="SubtypesDisjointUnion.TPI" class="idref" href="#SubtypesDisjointUnion.TPI"><span class="id" title="variable">TPI</span></a> : <span class="id" title="abbreviation">subFinType</span> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.PI"><span class="id" title="variable">PI</span></a>.<br/>
<br/>
<span class="id" title="keyword">Variable</span> <a id="SubtypesDisjointUnion.Pi" class="idref" href="#SubtypesDisjointUnion.Pi"><span class="id" title="variable">Pi</span></a> : <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TI"><span class="id" title="variable">TI</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#::type_scope:x_'->'_x"><span class="id" title="notation">-></span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#pred"><span class="id" title="definition">pred</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.T"><span class="id" title="variable">T</span></a>.<br/>
<span class="id" title="keyword">Variable</span> <a id="SubtypesDisjointUnion.TPi" class="idref" href="#SubtypesDisjointUnion.TPi"><span class="id" title="variable">TPi</span></a> : <span class="id" title="keyword">forall</span> <a id="i:62" class="idref" href="#i:62"><span class="id" title="binder">i</span></a> : <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TPI"><span class="id" title="variable">TPI</span></a>, <span class="id" title="abbreviation">subFinType</span> (<a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.Pi"><span class="id" title="variable">Pi</span></a> (<span class="id" title="abbreviation">val</span> <a class="idref" href="Combi.Basic.combclass.html#i:62"><span class="id" title="variable">i</span></a>)).<br/>
<br/>
<span class="id" title="keyword">Variable</span> <a id="SubtypesDisjointUnion.FI" class="idref" href="#SubtypesDisjointUnion.FI"><span class="id" title="variable">FI</span></a> : <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.T"><span class="id" title="variable">T</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#::type_scope:x_'->'_x"><span class="id" title="notation">-></span></a> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TI"><span class="id" title="variable">TI</span></a>.<br/>
<span class="id" title="keyword">Hypothesis</span> <a id="SubtypesDisjointUnion.HPTi" class="idref" href="#SubtypesDisjointUnion.HPTi"><span class="id" title="variable">HPTi</span></a> : <span class="id" title="keyword">forall</span> <a id="i:67" class="idref" href="#i:67"><span class="id" title="binder">i</span></a> : <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TPI"><span class="id" title="variable">TPI</span></a>, <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrfun.html#44b19bd81f7a1388073ea8a65e6fa993"><span class="id" title="notation">(</span></a><a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrbool.html#predI"><span class="id" title="definition">predI</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.P"><span class="id" title="variable">P</span></a> (<span class="id" title="definition">pred1</span> (<span class="id" title="abbreviation">val</span> <a class="idref" href="Combi.Basic.combclass.html#i:67"><span class="id" title="variable">i</span></a>) <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrfun.html#687e14754dadb7c0b04f27d8f71d2638"><span class="id" title="notation">\</span></a><a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrfun.html#687e14754dadb7c0b04f27d8f71d2638"><span class="id" title="notation">o</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.FI"><span class="id" title="variable">FI</span></a>)<a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrfun.html#44b19bd81f7a1388073ea8a65e6fa993"><span class="id" title="notation">)</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrfun.html#44b19bd81f7a1388073ea8a65e6fa993"><span class="id" title="notation">=1</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrfun.html#44b19bd81f7a1388073ea8a65e6fa993"><span class="id" title="notation">(</span></a><a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.Pi"><span class="id" title="variable">Pi</span></a> (<span class="id" title="abbreviation">val</span> <a class="idref" href="Combi.Basic.combclass.html#i:67"><span class="id" title="variable">i</span></a>)<a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.ssr.ssrfun.html#44b19bd81f7a1388073ea8a65e6fa993"><span class="id" title="notation">)</span></a>.<br/>
<span class="id" title="keyword">Hypothesis</span> <a id="SubtypesDisjointUnion.Hpart" class="idref" href="#SubtypesDisjointUnion.Hpart"><span class="id" title="variable">Hpart</span></a> : <span class="id" title="keyword">forall</span> <a id="x:70" class="idref" href="#x:70"><span class="id" title="binder">x</span></a> : <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.T"><span class="id" title="variable">T</span></a>, <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.P"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#x:70"><span class="id" title="variable">x</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#::type_scope:x_'->'_x"><span class="id" title="notation">-></span></a> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.PI"><span class="id" title="variable">PI</span></a> (<a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.FI"><span class="id" title="variable">FI</span></a> <a class="idref" href="Combi.Basic.combclass.html#x:70"><span class="id" title="variable">x</span></a>).<br/>
<br/>
<span class="id" title="keyword">Definition</span> <a id="enum_union" class="idref" href="#enum_union"><span class="id" title="definition">enum_union</span></a> := <span class="id" title="definition">flatten</span> <span class="id" title="notation">[</span><span class="id" title="notation">seq</span> <span class="id" title="definition">map</span> <span class="id" title="abbreviation">val</span> (<span class="id" title="abbreviation">enum</span> (<a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TPi"><span class="id" title="variable">TPi</span></a> <a class="idref" href="Combi.Basic.combclass.html#i:73"><span class="id" title="variable">i</span></a>)) <span class="id" title="notation">|</span> <a id="i:73" class="idref" href="#i:73"><span class="id" title="binder"><span id="i:74" class="id"><span id="i:75" class="id"><span id="i:76" class="id">i</span></span></span></span></a> <a id="i:74" class="idref" href="#i:74"><span class="id" title="binder"><span id="i:76" class="id">:</span></span></a> <a id="i:74" class="idref" href="#i:74"><span class="id" title="binder"><span id="i:76" class="id">TPI</span></span></a><span class="id" title="notation">]</span>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="all_unionP" class="idref" href="#all_unionP"><span class="id" title="lemma">all_unionP</span></a> : <span class="id" title="definition">all</span> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.P"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#enum_union"><span class="id" title="definition">enum_union</span></a>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="count_unionP" class="idref" href="#count_unionP"><span class="id" title="lemma">count_unionP</span></a> <a id="x:77" class="idref" href="#x:77"><span class="id" title="binder">x</span></a> : <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.P"><span class="id" title="variable">P</span></a> <a class="idref" href="Combi.Basic.combclass.html#x:77"><span class="id" title="variable">x</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#::type_scope:x_'->'_x"><span class="id" title="notation">-></span></a> <span class="id" title="abbreviation">count_mem</span> <a class="idref" href="Combi.Basic.combclass.html#x:77"><span class="id" title="variable">x</span></a> <a class="idref" href="Combi.Basic.combclass.html#enum_union"><span class="id" title="definition">enum_union</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> 1.<br/>
<br/>
<span class="id" title="keyword">Let</span> <a id="SubtypesDisjointUnion.union_enum" class="idref" href="#SubtypesDisjointUnion.union_enum"><span class="id" title="variable">union_enum</span></a> := <a class="idref" href="Combi.Basic.combclass.html#subType_seq"><span class="id" title="definition">subType_seq</span></a> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TP"><span class="id" title="variable">TP</span></a> <a class="idref" href="Combi.Basic.combclass.html#enum_union"><span class="id" title="definition">enum_union</span></a>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="subType_unionE" class="idref" href="#subType_unionE"><span class="id" title="lemma">subType_unionE</span></a> : <span class="id" title="definition">map</span> <span class="id" title="abbreviation">val</span> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.union_enum"><span class="id" title="variable">union_enum</span></a> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="Combi.Basic.combclass.html#enum_union"><span class="id" title="definition">enum_union</span></a>.<br/>
<span class="id" title="keyword">Lemma</span> <a id="finite_unionP" class="idref" href="#finite_unionP"><span class="id" title="lemma">finite_unionP</span></a> : <span class="id" title="abbreviation">Finite.axiom</span> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.union_enum"><span class="id" title="variable">union_enum</span></a>.<br/>
<span class="id" title="keyword">Definition</span> <a id="union_finType" class="idref" href="#union_finType"><span class="id" title="definition">union_finType</span></a> : <span class="id" title="abbreviation">finType</span> :=<br/>
<span class="id" title="var">HB.pack</span> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TP"><span class="id" title="variable">TP</span></a> (<span class="id" title="abbreviation">isFinite.Build</span> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TP"><span class="id" title="variable">TP</span></a> <a class="idref" href="Combi.Basic.combclass.html#finite_unionP"><span class="id" title="lemma">finite_unionP</span></a>).<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="enum_unionE" class="idref" href="#enum_unionE"><span class="id" title="lemma">enum_unionE</span></a> :<br/>
<span class="id" title="definition">map</span> <span class="id" title="abbreviation">val</span> (<span class="id" title="abbreviation">enum</span> <a class="idref" href="Combi.Basic.combclass.html#union_finType"><span class="id" title="definition">union_finType</span></a>) <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <a class="idref" href="Combi.Basic.combclass.html#enum_union"><span class="id" title="definition">enum_union</span></a>.<br/>
<br/>
<span class="id" title="keyword">Lemma</span> <a id="card_unionE" class="idref" href="#card_unionE"><span class="id" title="lemma">card_unionE</span></a> : <span class="id" title="notation">#|</span><a class="idref" href="Combi.Basic.combclass.html#union_finType"><span class="id" title="definition">union_finType</span></a><span class="id" title="notation">|</span> <a class="idref" href="http://rocq-prover.org/doc/V9.1.1/stdlib//Corelib.Init.Logic.html#6cd0f7b28b6092304087c7049437bb1a"><span class="id" title="notation">=</span></a> <span class="id" title="notation">\</span><span class="id" title="notation">sum_</span><span class="id" title="notation">(</span><a id="i:81" class="idref" href="#i:81"><span class="id" title="binder"><span id="i:82" class="id"><span id="i:83" class="id">i</span></span></span></a> <span class="id" title="notation">:</span> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TPI"><span class="id" title="variable">TPI</span></a><span class="id" title="notation">)</span> <span class="id" title="notation">#|</span><a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion.TPi"><span class="id" title="variable">TPi</span></a> <a class="idref" href="Combi.Basic.combclass.html#i:81"><span class="id" title="variable">i</span></a><span class="id" title="notation">|</span>.<br/>
<br/>
<span class="id" title="keyword">End</span> <a class="idref" href="Combi.Basic.combclass.html#SubtypesDisjointUnion"><span class="id" title="section">SubtypesDisjointUnion</span></a>.<br/>
</div>
</div>
<div id="footer">
<hr/><a href="index.html">Index</a><hr/>This page has been generated by <a href="http://rocq-prover.org/">coqdoc</a>
</div>
</div>
</body>
</html>