Inductively Defined Sets
We can define sets inductively/recursively as well.
Example
1:
The set
S
is defined as
0
∈
S
∀
n
∈
S
,
n
+ 1
∈
S
Note that
S
=
N
(the set of natural numbers)
Example
2: The set
T
is defined as
(0, 3)
∈
T
∀
(
w
,
x
)
∈
T
,
∀
(
y
,
z
)
∈
T
,
(
w
+
y
,
x
+ z)
∈
T
∀
(
w
,
x
)
∈
T
,
∀
(
y
,
z
)
∈
T
,
(
w
−
y
,
x
−
z)
∈
T
Note that
T
= { (0, 3
m
)
m
∈
Z
}
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Comparing two functions
Which of these two procedures is faster?
1:
procedure NAE1(a : array of n reals) : bool
2:
for i := 1 to n1
3:
for j := i+1 to n
4:
if a[i]
≠
a[j]
5:
return true
6:
return false
1:
procedure NAE2(a : array of n reals) : bool
2:
for i := 1 to n1
3:
if a[i]
≠
a[i+1]
4:
return true
5:
return false
Convince yourself that both procedures do the same thing. Suppose NAE1
takes
T
1
(
n
) steps and NAE2 takes
T
2
(
n
) steps on an array of size
n
It is clear that
∀
n
∈
N
,
T
1
(
n
)
≤
T
2
(
n
),
so NAE1 is “faster”. We will
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '10
 fleck
 Logic, Extensional definition, Philosophical logic, Inductively defined sets

Click to edit the document details