-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetForm.Stst.fs
108 lines (85 loc) · 2.87 KB
/
SetForm.Stst.fs
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
namespace Pslab.Limits.SetForm
module Stst =
// 2.
// Sum-type form of Sets ("successor-terminus")
// Stst Set
type SetSucc<'t> (elems: List<Sset<'t>>) =
member this.elems = elems
and Sset<'t> = T of option<'t> | S of SetSucc<'t>
// Stst Tuple. Not a Set.
type TupleSucc<'t> (a: Stuple<'t>, b: Stuple<'t>) =
member this.a = a
member this.b = b
and Stuple<'t> = T of option<'t> | S of TupleSucc<'t>
// Ssets and Stuples differ in their elements' cardinality of infinite and
// finite
// Stuples and Otuples differ by Stuple not being a Set and in their
// cardinality, where infinitely many Stuple sizes exist and finitely many
// Otuple sizes exist
let construct() =
let _: Sset<int> =
Sset.S(SetSucc<int>([
Sset.T(Some(0));
Sset.T(Some(1))
]))
let s =
Sset.S(SetSucc<int>([
Sset.S(SetSucc<int>([
Sset.T(Some(0))
]));
Sset.S(SetSucc<int>([
Sset.T(Some(1))
]));
Sset.T(Some(2))
]))
let s =
Sset.S(SetSucc<int>([
Sset.S(SetSucc<int>([
Sset.T(Some(0))
]));
Sset.S(SetSucc<int>([
Sset.T(Some(1))
]));
Sset.T(Some(2))
]))
Sset.S(SetSucc<int>([
Sset.T(None);
Sset.T(None)
])) |> ignore
// Stuples of size 1 are a "terminus"
let _: Stuple<int> =
Stuple.T(Some(1))
// Stuples of size 2+ are "successors"
let _: Stuple<int> =
Stuple.S(TupleSucc<int>(
Stuple.T(Some(1)),
Stuple.T(Some(2))
))
// Stuples of arbitrary size can be formed
let _: Stuple<int> =
Stuple.S(TupleSucc<int>(
Stuple.S(TupleSucc<int>(
Stuple.T(Some(1)),
Stuple.T(Some(2))
)),
Stuple.T(Some(3))
))
// Tuples with irregular hierarchies can be formed. To inspect this, we
// need to print out our tree.
let _: Stuple<int> =
Stuple.S(TupleSucc<int>(
Stuple.S(TupleSucc<int>(
Stuple.T(Some(1)),
Stuple.T(Some(2))
)),
Stuple.S(TupleSucc<int>(
Stuple.S(TupleSucc<int>(
Stuple.T(Some(3)),
Stuple.T(Some(4))
)),
Stuple.T(Some(4))
))
))
()
let print() =
()