1
- {-# OPTIONS --erasure #-}
2
1
3
2
-- | Proofs on 'Set'.
4
3
module Data.Set.Prop where
@@ -13,7 +12,7 @@ open import Haskell.Data.Set
13
12
Properties
14
13
Basic
15
14
------------------------------------------------------------------------------}
16
- module _ {a : Set } {{_ : Ord a}} where
15
+ module _ {a : Type } {{_ : Ord a}} where
17
16
18
17
--
19
18
prop-null-empty
@@ -26,11 +25,11 @@ module _ {a : Set} {{_ : Ord a}} where
26
25
Properties
27
26
https://en.wikipedia.org/wiki/Boolean_algebra_(structure)
28
27
------------------------------------------------------------------------------}
29
- module _ {a : Set } {{_ : Ord a}} where
28
+ module _ {a : Type } {{_ : Ord a}} where
30
29
31
30
--
32
31
prop-union-idem
33
- : ∀ {sa : ℙ a}
32
+ : ∀ {sa : Set a}
34
33
→ union sa sa
35
34
≡ sa
36
35
--
@@ -46,7 +45,7 @@ module _ {a : Set} {{_ : Ord a}} where
46
45
47
46
--
48
47
prop-union-assoc
49
- : ∀ {sa sb sc : ℙ a}
48
+ : ∀ {sa sb sc : Set a}
50
49
→ union (union sa sb) sc
51
50
≡ union sa (union sb sc)
52
51
--
@@ -66,7 +65,7 @@ module _ {a : Set} {{_ : Ord a}} where
66
65
67
66
--
68
67
prop-union-sym
69
- : ∀ {sa sb : ℙ a}
68
+ : ∀ {sa sb : Set a}
70
69
→ union sa sb
71
70
≡ union sb sa
72
71
--
@@ -83,7 +82,7 @@ module _ {a : Set} {{_ : Ord a}} where
83
82
84
83
--
85
84
prop-union-absorb
86
- : ∀ {sa sb : ℙ a}
85
+ : ∀ {sa sb : Set a}
87
86
→ union sa (intersection sa sb)
88
87
≡ sa
89
88
--
@@ -100,7 +99,7 @@ module _ {a : Set} {{_ : Ord a}} where
100
99
101
100
--
102
101
prop-union-identity
103
- : ∀ {sa : ℙ a}
102
+ : ∀ {sa : Set a}
104
103
→ union sa empty
105
104
≡ sa
106
105
--
@@ -117,7 +116,7 @@ module _ {a : Set} {{_ : Ord a}} where
117
116
118
117
--
119
118
prop-union-intersection-distribute
120
- : ∀ {sa sb sc : ℙ a}
119
+ : ∀ {sa sb sc : Set a}
121
120
→ union sa (intersection sb sc)
122
121
≡ intersection (union sa sb) (union sa sc)
123
122
--
@@ -139,7 +138,7 @@ module _ {a : Set} {{_ : Ord a}} where
139
138
140
139
--
141
140
prop-intersection-idem
142
- : ∀ {sa : ℙ a}
141
+ : ∀ {sa : Set a}
143
142
→ intersection sa sa
144
143
≡ sa
145
144
--
@@ -155,7 +154,7 @@ module _ {a : Set} {{_ : Ord a}} where
155
154
156
155
--
157
156
prop-intersection-assoc
158
- : ∀ {sa sb sc : ℙ a}
157
+ : ∀ {sa sb sc : Set a}
159
158
→ intersection (intersection sa sb) sc
160
159
≡ intersection sa (intersection sb sc)
161
160
--
@@ -175,7 +174,7 @@ module _ {a : Set} {{_ : Ord a}} where
175
174
176
175
--
177
176
prop-intersection-sym
178
- : ∀ {sa sb : ℙ a}
177
+ : ∀ {sa sb : Set a}
179
178
→ intersection sa sb
180
179
≡ intersection sb sa
181
180
--
@@ -192,7 +191,7 @@ module _ {a : Set} {{_ : Ord a}} where
192
191
193
192
--
194
193
prop-intersection-absorb
195
- : ∀ {sa sb : ℙ a}
194
+ : ∀ {sa sb : Set a}
196
195
→ intersection sa (union sa sb)
197
196
≡ sa
198
197
--
@@ -209,7 +208,7 @@ module _ {a : Set} {{_ : Ord a}} where
209
208
210
209
--
211
210
prop-intersection-union-distribute
212
- : ∀ {sa sb sc : ℙ a}
211
+ : ∀ {sa sb sc : Set a}
213
212
→ intersection sa (union sb sc)
214
213
≡ union (intersection sa sb) (intersection sa sc)
215
214
--
@@ -230,7 +229,7 @@ module _ {a : Set} {{_ : Ord a}} where
230
229
231
230
--
232
231
prop-intersection-empty-right
233
- : ∀ {sa : ℙ a}
232
+ : ∀ {sa : Set a}
234
233
→ intersection sa empty
235
234
≡ empty
236
235
--
@@ -247,7 +246,7 @@ module _ {a : Set} {{_ : Ord a}} where
247
246
248
247
--
249
248
prop-intersection-empty-left
250
- : ∀ {sa : ℙ a}
249
+ : ∀ {sa : Set a}
251
250
→ intersection empty sa
252
251
≡ empty
253
252
--
@@ -265,11 +264,11 @@ module _ {a : Set} {{_ : Ord a}} where
265
264
Properties
266
265
involving difference
267
266
------------------------------------------------------------------------------}
268
- module _ {a : Set } {{_ : Ord a}} where
267
+ module _ {a : Type } {{_ : Ord a}} where
269
268
270
269
--
271
270
prop-intersection-difference
272
- : ∀ {sa sb : ℙ a}
271
+ : ∀ {sa sb : Set a}
273
272
→ intersection sb (difference sa sb)
274
273
≡ empty
275
274
--
@@ -291,7 +290,7 @@ module _ {a : Set} {{_ : Ord a}} where
291
290
292
291
--
293
292
prop-disjoint-difference
294
- : ∀ {sa sb : ℙ a}
293
+ : ∀ {sa sb : Set a}
295
294
→ disjoint sb (difference sa sb)
296
295
≡ True
297
296
--
@@ -300,7 +299,7 @@ module _ {a : Set} {{_ : Ord a}} where
300
299
301
300
--
302
301
prop-union-difference
303
- : ∀ {sa sb : ℙ a}
302
+ : ∀ {sa sb : Set a}
304
303
→ union (difference sa sb) sb
305
304
≡ union sa sb
306
305
--
@@ -323,7 +322,7 @@ module _ {a : Set} {{_ : Ord a}} where
323
322
324
323
--
325
324
prop-difference-union-x
326
- : ∀ {sa sb sc : ℙ a}
325
+ : ∀ {sa sb sc : Set a}
327
326
→ difference (union sa sb) sc
328
327
≡ union (difference sa sc) (difference sb sc)
329
328
--
@@ -347,7 +346,7 @@ module _ {a : Set} {{_ : Ord a}} where
347
346
348
347
--
349
348
prop-deMorgan-difference-intersection
350
- : ∀ {sa sb sc : ℙ a}
349
+ : ∀ {sa sb sc : Set a}
351
350
→ difference sa (intersection sb sc)
352
351
≡ union (difference sa sb) (difference sa sc)
353
352
--
@@ -369,7 +368,7 @@ module _ {a : Set} {{_ : Ord a}} where
369
368
370
369
--
371
370
prop-deMorgan-difference-union
372
- : ∀ {sa sb sc : ℙ a}
371
+ : ∀ {sa sb sc : Set a}
373
372
→ difference sa (union sb sc)
374
373
≡ intersection (difference sa sb) (difference sa sc)
375
374
--
@@ -393,27 +392,27 @@ module _ {a : Set} {{_ : Ord a}} where
393
392
Properties
394
393
involving isSubsetOf
395
394
------------------------------------------------------------------------------}
396
- module _ {a : Set } {{_ : Ord a}} where
395
+ module _ {a : Type } {{_ : Ord a}} where
397
396
398
397
-- | The 'empty' set is a subset of every set.
399
398
prop-isSubsetOf-empty
400
- : ∀ {sa : ℙ a}
399
+ : ∀ {sa : Set a}
401
400
→ isSubsetOf empty sa ≡ True
402
401
--
403
402
prop-isSubsetOf-empty {sa} =
404
403
prop-intersection→isSubsetOf empty sa prop-intersection-empty-left
405
404
406
405
-- | 'isSubsetOf' is reflexive
407
406
prop-isSubsetOf-refl
408
- : ∀ {sa : ℙ a}
407
+ : ∀ {sa : Set a}
409
408
→ isSubsetOf sa sa ≡ True
410
409
--
411
410
prop-isSubsetOf-refl {sa} =
412
411
prop-intersection→isSubsetOf sa sa prop-intersection-idem
413
412
414
413
-- | 'isSubsetOf' is antisymmetric
415
414
prop-isSubsetOf-antisym
416
- : ∀ {sa sb : ℙ a}
415
+ : ∀ {sa sb : Set a}
417
416
→ isSubsetOf sa sb ≡ True
418
417
→ isSubsetOf sb sa ≡ True
419
418
→ sa ≡ sb
@@ -440,7 +439,7 @@ module _ {a : Set} {{_ : Ord a}} where
440
439
441
440
-- | 'isSubsetOf' is transitive
442
441
prop-isSubsetOf-trans
443
- : ∀ {sa sb sc : ℙ a}
442
+ : ∀ {sa sb sc : Set a}
444
443
→ isSubsetOf sa sb ≡ True
445
444
→ isSubsetOf sb sc ≡ True
446
445
→ isSubsetOf sa sc ≡ True
@@ -471,7 +470,7 @@ module _ {a : Set} {{_ : Ord a}} where
471
470
472
471
--
473
472
prop-isSubsetOf-intersection
474
- : ∀ {sa sb : ℙ a}
473
+ : ∀ {sa sb : Set a}
475
474
→ isSubsetOf (intersection sa sb) sb ≡ True
476
475
--
477
476
prop-isSubsetOf-intersection {sa} {sb} =
@@ -487,7 +486,7 @@ module _ {a : Set} {{_ : Ord a}} where
487
486
488
487
--
489
488
prop-isSubsetOf-difference
490
- : ∀ {sa sb : ℙ a}
489
+ : ∀ {sa sb : Set a}
491
490
→ isSubsetOf (difference sa sb) sa ≡ True
492
491
--
493
492
prop-isSubsetOf-difference {sa} {sb} =
0 commit comments