git @ Cat's Eye Technologies Eqthy / 312b3fe
Have all examples live in the same directory right now. Chris Pressey 1 year, 2 months ago
5 changed file(s) with 74 addition(s) and 61 deletion(s). Raw diff Collapse all Expand all
33 .gitignore
44 bin/eqthy
55 src/eqthy/__init__.py
6 test.sh
76 Copyright: The authors of these works have dedicated them to the public domain.
87 License: Unlicense
4343 * in [Propositional Algebra](eg/propositional-algebra.eqthy.md);
4444 * of De Morgan's laws in [Boolean Algebra](eg/boolean-algebra.eqthy.md);
4545 * in [Combinatory Logic](eg/combinatory-logic.eqthy.md),
46 * of some properties of [set difference](eg/set-difference.eqthy.md),
4647
4748 with hopefully more to come in the future.
4849
+0
-57
eg/further-develop/set-difference.eqthy.md less more
0 Set Difference
1 ==============
2
3 <!--
4 SPDX-FileCopyrightText: The authors of this work have dedicated it to the public domain.
5 For more information, please refer to <https://unlicense.org/>
6 SPDX-License-Identifier: Unlicense
7 -->
8
9 Some theorems about set difference.
10
11 Using the [Algebra of sets (Wikipedia)](https://en.wikipedia.org/wiki/Algebra_of_sets)
12 as a basis.
13
14 Include [../algebra-of-sets.eqthy.md](../algebra-of-sets.eqthy.md) before this file!
15
16 axiom (#union-de-morg) comp(inter(A, B)) = union(comp(A), comp(B))
17 axiom (#inter-de-morg) comp(union(A, B)) = inter(comp(A), comp(B))
18
19 Definition of set difference.
20
21 axiom (#diff) diff(A, B) = inter(A, comp(B))
22
23 A theorem about set difference: difference distributes over union.
24
25 theorem (#diff-union-distrib)
26 union(diff(A, C), diff(B, C)) = diff(union(A, B), C)
27 proof
28 union(diff(A, C), diff(B, C)) = union(diff(A, C), diff(B, C))
29 union(diff(A, C), diff(B, C)) = union(diff(A, C), inter(B, comp(C)))
30 union(diff(A, C), diff(B, C)) = union(inter(A, comp(C)), inter(B, comp(C)))
31 union(diff(A, C), diff(B, C)) = union(inter(A, comp(C)), inter(comp(C), B))
32 union(diff(A, C), diff(B, C)) = union(inter(comp(C), A), inter(comp(C), B))
33 union(diff(A, C), diff(B, C)) = inter(comp(C), union(A, B))
34 union(diff(A, C), diff(B, C)) = inter(union(A, B), comp(C))
35 union(diff(A, C), diff(B, C)) = diff(union(A, B), C)
36 qed
37
38 Another theorem about set difference. This one uses De Morgan's law, which
39 has been added as an axiom above. For a working-out of it, see the
40 Boolean algebra document.
41
42 theorem (#diff-of-inter-is-diff)
43 diff(A, B) = diff(A, inter(A, B))
44 proof
45 diff(A, B) = diff(A, B)
46 diff(A, B) = inter(A, comp(B))
47 diff(A, B) = union(inter(A, comp(B)), e)
48 diff(A, B) = union(e, inter(A, comp(B)))
49 diff(A, B) = union(inter(A, comp(A)), inter(A, comp(B)))
50 diff(A, B) = inter(A, union(comp(A), comp(B)))
51 diff(A, B) = inter(A, comp(inter(A, B)))
52 diff(A, B) = diff(A, inter(A, B))
53 qed
54
55 Both of these theorems were adapted from
56 [this presentation by Mustafa Jarrar](http://www.jarrar.info/courses/DMath/Jarrar.LectureNotes.6.3%20Algebric%20Proofs.pdf).
0 Set Difference
1 ==============
2
3 <!--
4 SPDX-FileCopyrightText: The authors of this work have dedicated it to the public domain.
5 For more information, please refer to <https://unlicense.org/>
6 SPDX-License-Identifier: Unlicense
7 -->
8
9 Some theorems about set difference.
10
11 Using the [Algebra of sets (Wikipedia)](https://en.wikipedia.org/wiki/Algebra_of_sets)
12 as a basis.
13
14 Include [../algebra-of-sets.eqthy.md](../algebra-of-sets.eqthy.md) before this file!
15
16 axiom (#union-de-morg) comp(inter(A, B)) = union(comp(A), comp(B))
17 axiom (#inter-de-morg) comp(union(A, B)) = inter(comp(A), comp(B))
18
19 Definition of set difference.
20
21 axiom (#diff) diff(A, B) = inter(A, comp(B))
22
23 A theorem about set difference: difference distributes over union.
24
25 theorem (#diff-union-distrib)
26 union(diff(A, C), diff(B, C)) = diff(union(A, B), C)
27 proof
28 union(diff(A, C), diff(B, C)) = union(diff(A, C), diff(B, C))
29 union(diff(A, C), diff(B, C)) = union(diff(A, C), inter(B, comp(C)))
30 union(diff(A, C), diff(B, C)) = union(inter(A, comp(C)), inter(B, comp(C)))
31 union(diff(A, C), diff(B, C)) = union(inter(A, comp(C)), inter(comp(C), B))
32 union(diff(A, C), diff(B, C)) = union(inter(comp(C), A), inter(comp(C), B))
33 union(diff(A, C), diff(B, C)) = inter(comp(C), union(A, B))
34 union(diff(A, C), diff(B, C)) = inter(union(A, B), comp(C))
35 union(diff(A, C), diff(B, C)) = diff(union(A, B), C)
36 qed
37
38 Another theorem about set difference. This one uses De Morgan's law, which
39 has been added as an axiom above. For a working-out of it, see the
40 Boolean algebra document.
41
42 theorem (#diff-of-inter-is-diff)
43 diff(A, B) = diff(A, inter(A, B))
44 proof
45 diff(A, B) = diff(A, B)
46 diff(A, B) = inter(A, comp(B))
47 diff(A, B) = union(inter(A, comp(B)), e)
48 diff(A, B) = union(e, inter(A, comp(B)))
49 diff(A, B) = union(inter(A, comp(A)), inter(A, comp(B)))
50 diff(A, B) = inter(A, union(comp(A), comp(B)))
51 diff(A, B) = inter(A, comp(inter(A, B)))
52 diff(A, B) = diff(A, inter(A, B))
53 qed
54
55 Both of these theorems were adapted from
56 [this presentation by Mustafa Jarrar](http://www.jarrar.info/courses/DMath/Jarrar.LectureNotes.6.3%20Algebric%20Proofs.pdf).
00 #!/bin/sh -e
1
2 # SPDX-FileCopyrightText: The authors of this work have dedicated it to the public domain.
3 # For more information, please refer to <https://unlicense.org/>
4 # SPDX-License-Identifier: Unlicense
15
26 if command -v flake8 > /dev/null; then
37 echo "flake8 --ignore=E501 src"
1418 fi
1519
1620 if command -v reuse > /dev/null; then
17 reuse lint
21 echo "reuse lint --quiet"
22 reuse lint --quiet || reuse lint
1823 else
1924 echo "reuse not found, skipping check"
2025 fi
2126
2227 falderal doc/*.md || exit 1
2328 for F in eg/*.eqthy.md; do
24 echo "./bin/eqthy $F"
25 ./bin/eqthy --traceback $F || exit 1
29 case "$F" in
30 *set-difference*)
31 echo "./bin/eqthy eg/algebra-of-sets.eqthy.md $F"
32 ./bin/eqthy --traceback eg/algebra-of-sets.eqthy.md $F || exit 1
33 ;;
34 *)
35 echo "./bin/eqthy $F"
36 ./bin/eqthy --traceback $F || exit 1
37 ;;
38 esac
2639 done
2740 for F in eg/incorrect/*.eqthy.md; do
2841 echo $F