Thanks Ed,
Comments below:
Sincerely,
Rich Cooper
EnglishLogicKernel.com
Rich AT EnglishLogicKernel DOT com
9 4 9 \ 5 2 5 - 5 7 1 2
-----Original Message-----
From: ontolog-forum-bounces@xxxxxxxxxxxxxxxx
[mailto:ontolog-forum-bounces@xxxxxxxxxxxxxxxx] On Behalf Of Ed Barkmeyer
Sent: Wednesday, October 13, 2010 3:23 PM
To: [ontolog-forum]
Subject: Re: [ontolog-forum] HOL decidability [Was: using SKOS forcontrolled
values for controlledvocabulary]
I shouldn't get into this, but...
Rich Cooper wrote:
> Thanks for the routine, but that is not an iterator of primes; it
is
> an iterator of integers. By iterating through all the
integers, your
> routine finds primes, but it does not iterate the primes.
The fact
> that you close the scope around tests for primes doesn’t
make it an
> iterator.
>
>
>
> The idea behind the iterator is to produce one new one, given the
old
> one as a starting point.
>
That is one version of the inductive model of
iteration. The more
robust version is to produce the next one, given all
predecessors. And
of course, Bill's code does just that. The
"all predecessors" approach
is equally valid mathematically, and it works for
spaces with partial
orderings, while the "from n, produce n+1"
approach does not (in general).
Since the claim I made was that there is
no function that iterates the primes, why is all that extra profundity
necessary? I didn't introduce "the inductive model of
iteration", or distinguish among models, so why do you bring that up
anyway? It doesn't matter what you use if it can't do the job of
iterating primes, and I don't mean generating and testing primes, which you
mistake as iterating them.
Rich's model doesn't work for Fibonacci numbers,
either, even though you
only need two predecessors.
Since I never claimed it would work for
Fibonacci numbers, why does that matter, and what has that got to do with
iterating primes?
I suppose it would work for Cauchy enumeration of
n-tuples, which is the
common countability proof technique.
But has nothing to do with iterating
primes. Where are you exploring with this crazy quilt of off the wall
associations?
>
> The method you are using is often called
Eratosthenes’ Sieve, which is
> a well known method to calculate primes, but NOT
to iterate them.
> The difference is in what is being
enumerated inside the code.
>
Well, more carefully, the Sieve of Eratosthenes is an
iterative
algorithm for producing all prime numbers.
It is an algorithm which iterates over the
integers, not the primes; it generates and tests the integers to identify
primes. That's the Sieve part.
I am familiar with the term "iterator" only
as a software object, and
OBTW, java.util.Iterator is class of somewhat diverse
"objects"
(algorithms), none of which takes an instance and
produces the next.
Instead, each has a retained state, and each
invocation of next()
produces the successor state and returns the corresponding
instance of
the "collection".
Any iterator which uses the method you endorsed will fail the first
usage; it takes too long to generate the next one. And I didn't claim
that Java iterators are well written, or obey good engineering principles, so
why are you introducing yet another off the wall association?
Thinking of prime numbers as an infinite collection,
such an "iterator" will be seen to produce
the primes in order starting
from an initial state, while the actual implementation
mechanism is
"encapsulated" (and might well be the
Sieve). IMO, that is actually
pretty close to the mathematical notion, in which the
creature is
categorized by a certain set of properties that it
exhibits, regardless
of what other bizarre properties it may have.
Which only means that a
Java "iterator" is not a Rich Cooper
"iterator".
A Java iterator SHOULD be a Rich Cooper
iterator, but if it is written to use your generate and test method, it certainly
isn't a good iterator, and doesn't serve the purpose. Sorry.
So, as far as I can tell, Rich asserts that Bill's
algorithm is not an
instance of the definition Rich assigns to
"iterator" above. I agree.
Now, how that relates to decidability, which is about
the existence of
an algorithm that terminates in finite time, I am at a
loss to
understand. The ontolog forum exploder
does seem to be a study in
"free association."
You're the one who free associated all
through this email - so look at where the trail shows you have been.
-Ed
>
>
> -Rich
>
>
>
> Sincerely,
>
> Rich Cooper
>
> EnglishLogicKernel.com
>
> Rich AT EnglishLogicKernel DOT com
>
> 9 4 9 \ 5 2 5 - 5 7 1 2
>
>
------------------------------------------------------------------------
>
> *From:* ontolog-forum-bounces@xxxxxxxxxxxxxxxx
> [mailto:ontolog-forum-bounces@xxxxxxxxxxxxxxxx]
*On Behalf Of *Bill
> Andersen
> *Sent:* Wednesday, October 13, 2010 12:52 PM
> *To:* [ontolog-forum] ; Rich Cooper
> *Subject:* Re: [ontolog-forum] HOL decidability
[Was: using SKOS
> forcontrolled values for controlledvocabulary]
>
>
>
> On Oct 13, 2010, at 01:56 , Rich Cooper wrote:
>
>
>
> Hi Duane, yes, iterators in software were what I
tried to convey
> there. There is no function that will
iterate the primes. By pairing
> each prime in ascending order with any other
iterated set, you create
> unique prime keys for each element of that set,
keys that cannot be
> factored.
>
>
>
> Thanks for your inputs,
>
> -Rich
>
>
>
> Hi Rich
>
>
>
> Here's a fixed precision implementation of a
prime iterator, along the
> lines Chris Menzel described.
>
>
>
> Enjoy
>
> ------------
>
>
>
> package foo;
>
>
>
> import java.util.Iterator;
>
>
>
> public class PrimeIterator implements
Iterator<Integer> {
>
>
>
> private
Integer n = 2;
>
>
>
>
@Override
>
> public
boolean hasNext() {
>
>
// Thanks to _Euclid_ :-D
>
>
return true;
>
> }
>
>
>
> private
boolean isPrime(Integer n) {
>
>
Integer i = 2;
>
>
while (i < n) {
>
>
if ((n % i) == 0) {
>
>
// _divisible_ by i < n
>
>
return false;
>
>
}
>
>
i++;
>
>
}
>
>
return true;
>
> }
>
>
>
>
@Override
>
> public
Integer next() {
>
>
while (!isPrime(n)) {
>
>
n++;
>
>
}
>
>
Integer tmp = n;
>
>
n++;
>
>
return tmp;
>
> }
>
>
>
>
@Override
>
> public
void remove() {
>
>
throw new UnsupportedOperationException();
>
> }
>
>
>
> public
static void main(String[] argz) {
>
>
PrimeIterator iter = new PrimeIterator();
>
>
while (iter.hasNext()) {
>
>
System.out.println(iter.next());
>
>
}
>
> }
>
>
>
> }
>
>
>
> Bill Andersen
>
> Highfleet, Inc. (www.highfleet.com
<http://www.highfleet.com>)
>
> 3600
O'Donnell Street, Suite 600
>
> Baltimore,
MD 21224
>
> Office: +1.410.675.1201
>
> Cell: +1.443.858.6444
>
> Fax: +1.410.675.1204
>
>
>
>
>
>
>
>
>
--
Edward J.
Barkmeyer
Email: edbark@xxxxxxxx
National Institute of Standards & Technology
Manufacturing Systems Integration Division
100
Bureau Drive, Stop
8263
Tel: +1 301-975-3528
Gaithersburg,
MD 20899-8263
FAX: +1 301-975-4694
"The opinions expressed above do not reflect
consensus of NIST,
and have not been reviewed by any Government
authority."
_________________________________________________________________
Message Archives:
http://ontolog.cim3.net/forum/ontolog-forum/
Config Subscr:
http://ontolog.cim3.net/mailman/listinfo/ontolog-forum/
Unsubscribe:
mailto:ontolog-forum-leave@xxxxxxxxxxxxxxxx
Shared Files: http://ontolog.cim3.net/file/
Community Wiki: http://ontolog.cim3.net/wiki/
To join:
http://ontolog.cim3.net/cgi-bin/wiki.pl?WikiHomePage#nid1J
To Post: mailto:ontolog-forum@xxxxxxxxxxxxxxxx