[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

A question about thinking 'abstractly'....

Chad

7/19/2011 7:20:00 PM

One of my friends who attends Harvard took Math 55. He mentioned that
a lot of it was being able to prove major theorems with only the aid
of the definitions. This got me to thinking. I've had a lot of people
help with me a programming problem by only providing defintions.

Is the thought process to proving some major theorems in math with
only the aid of the defintions similar to implementing some kind of
data structures when given only the definitions of a data structure?

Chad
20 Answers

ram

7/19/2011 7:43:00 PM

0

Chad <cdalten@gmail.com> writes:
>Is the thought process to proving some major theorems in math with
>only the aid of the defintions similar to implementing some kind of
>data structures when given only the definitions of a data structure?

See also:

http://en.wikipedia.org/wiki/Ab...(computer_science)

.

Ben Bacarisse

7/19/2011 8:27:00 PM

0

Chad <cdalten@gmail.com> writes:

> One of my friends who attends Harvard took Math 55. He mentioned that
> a lot of it was being able to prove major theorems with only the aid
> of the definitions. This got me to thinking. I've had a lot of people
> help with me a programming problem by only providing defintions.
>
> Is the thought process to proving some major theorems in math with
> only the aid of the defintions similar to implementing some kind of
> data structures when given only the definitions of a data structure?

I can't speak about thought processes, but there is a very deep formal
relationship between types and proofs (an isomorphism, in fact). Look
up the Curry-Howard correspondence if you want to find out more.

BTW, I can't see any connection to C so I've set followups to
comp.programming.

--
Ben.

Kleuskes & Moos

7/19/2011 9:03:00 PM

0

On Jul 19, 9:20 pm, Chad <cdal...@gmail.com> wrote:
> One of my friends who attends Harvard took Math 55. He mentioned that
> a lot of it was being able to prove major theorems with only the aid
> of the definitions. This got me to thinking.  I've had a lot of people
> help with me a programming problem by only providing defintions.
>
> Is the thought process to proving some major theorems in math with
> only the aid of the defintions similar to implementing some kind of
> data structures when given only the definitions of a data structure?

Not sure i understand correctly, but theorem provers have been around
for some time. C is not the most convenient language to implement one,
though.

See http://en.wikipedia.org/wiki/Theo...

Ulisses Araujo Costa

7/20/2011 9:23:00 AM

0

On 19 Jul, 20:20, Chad <cdal...@gmail.com> wrote:
> One of my friends who attends Harvard took Math 55. He mentioned that
> a lot of it was being able to prove major theorems with only the aid
> of the definitions. This got me to thinking.  I've had a lot of people
> help with me a programming problem by only providing defintions.
>
> Is the thought process to proving some major theorems in math with
> only the aid of the defintions similar to implementing some kind of
> data structures when given only the definitions of a data structure?
>
> Chad

Hello Chad,

Is the process of cocking a recipe with only the use of ingredients
similar to implementing some kind of
data structures when given only the definitions of a data structure?

When you prove something, regardless the mechanism you use, will be
faster if you use some of preexisting definitions, axioms,
theorems,... You can reinvent the well if you want to.

Regards,

Ulisses Araújo Costa - caos.di.uminho.pt/~ulisses

Kleuskes & Moos

7/20/2011 10:47:00 AM

0

On Jul 20, 11:23 am, Ulisses Araujo Costa
<ulissesmonheco...@gmail.com> wrote:
> On 19 Jul, 20:20, Chad <cdal...@gmail.com> wrote:
>
> > One of my friends who attends Harvard took Math 55. He mentioned that
> > a lot of it was being able to prove major theorems with only the aid
> > of the definitions. This got me to thinking.  I've had a lot of people
> > help with me a programming problem by only providing defintions.
>
> > Is the thought process to proving some major theorems in math with
> > only the aid of the defintions similar to implementing some kind of
> > data structures when given only the definitions of a data structure?
>
> > Chad
>
> Hello Chad,
>
> Is the process of cocking a recipe with only the use of ingredients
> similar to implementing some kind of
> data structures when given only the definitions of a data structure?
>
> When you prove something, regardless the mechanism you use, will be
> faster if you use some of preexisting definitions, axioms,
> theorems,... You can reinvent the well if you want to.

Nitpick... A "proof" in mathematics consists of showing that it
follows from axioms and theorems have already been shown to do that.
Otherwise they would not be theorems.

Ulisses Araujo Costa

7/20/2011 4:51:00 PM

0

On 20 Jul, 11:46, "Kleuskes & Moos" <kleu...@xs4all.nl> wrote:
> On Jul 20, 11:23 am, Ulisses Araujo Costa
>
>
>
>
>
>
>
>
>
> <ulissesmonheco...@gmail.com> wrote:
> > On 19 Jul, 20:20, Chad <cdal...@gmail.com> wrote:
>
> > > One of my friends who attends Harvard took Math 55. He mentioned that
> > > a lot of it was being able to prove major theorems with only the aid
> > > of the definitions. This got me to thinking.  I've had a lot of people
> > > help with me a programming problem by only providing defintions.
>
> > > Is the thought process to proving some major theorems in math with
> > > only the aid of the defintions similar to implementing some kind of
> > > data structures when given only the definitions of a data structure?
>
> > > Chad
>
> > Hello Chad,
>
> > Is the process of cocking a recipe with only the use of ingredients
> > similar to implementing some kind of
> > data structures when given only the definitions of a data structure?
>
> > When you prove something, regardless the mechanism you use, will be
> > faster if you use some of preexisting definitions, axioms,
> > theorems,... You can reinvent the well if you want to.
>
> Nitpick... A "proof" in mathematics consists of showing that it
> follows from axioms and theorems have already been shown to do that.
> Otherwise they would not be theorems.

My mistake, you are right! Theorems are already proved material.

--
Ulisses Araújo Costa - caos.di.uminho.pt/~ulisses

Rui Maciel

7/21/2011 3:28:00 AM

0

Chad wrote:

> One of my friends who attends Harvard took Math 55. He mentioned that
> a lot of it was being able to prove major theorems with only the aid
> of the definitions. This got me to thinking. I've had a lot of people
> help with me a programming problem by only providing defintions.
>
> Is the thought process to proving some major theorems in math with
> only the aid of the defintions similar to implementing some kind of
> data structures when given only the definitions of a data structure?

Sometimes it may be overlooked but programming is inherently and
fundamentally a mathematical endeavour, which basically involves nothing
else than a set of operators being applied to a set of fields in a specific
order in order to reach an intended outcome. Following this interpretation,
any API is nothing more than a set of definitions of a mix of operators and
sets which a programmer may apply to his sets of data. With this in mind,
the answer to your question would be a clear yes, mathematical reasoning is
as vital to a mathematician as it is to a programmer. It is because
mathematics and programming are the same thing.

But then the real world sets in.

The thing is, mathematicians spend their time and energy studying the
implications of some set of definitions but they also invest a lot of
themselves trying to prove that the stuff they come up with is correct.
This mindset is lost in software development, whose approach to the
mathematical problem of developing a program often ends with providing code
which only works as expected in very limited circumstances which no one
knows or cares to know. Even those who actually care for this sort of stuff
and actually know their onions shy away from this goal, a fact which may be
represented by Knuth's quote "Beware of bugs in the above code; I have only
proved it correct, not tried it."

Meanwhile, the programming world occupies itself hacking together sets of
instructions which no one actually cares they are proven to be correct, or
even if they are valid in the conceivable scenarios which they are designed
to operate. That is, when compared to how a mathematician may tackle a
problem, programmers don't actually know what they are doing and instead
embrace the fact that the stuff they create does break and that they can't
do anything to prevent it. The disregard for this mathematical correctness
has reached a level that some programming errors committed by programmers
are so widespread and so frequent that, instead of trying to make sure that
the programmer is sufficiently competent to avoid them, they are simply
embraced as a natural occurrence and technologies have been developed to be
able to sweep those programming errors under the proverbial rug, which is
the case of technologies such as garbage collection and sandboxes.

And the thing is, this isn't necessarily bad. Of course, it would be better
if every piece of softwar ever written would have been developed with enough
care to be successfully demonstrated to be correct. Yet, that would mean
that an ungodly amount of time and energy (and, of course, money) would be
spent on developing even the smallest program. Although it would save a lot
of time and energy in some areas (for example, the software security
business, at least as we know it, would have never existed) it would simply
be too cost-prohibitive and also time-consuming to develop any piece of
software.

So, to sum things up, programming is in fact applied math and therefore a
programmer needs to employ mathematical reasoning to develop software. Yet,
as no one bothers to prove their code to be correct, either by incompetence
or by simply not being able to afford it, the "correctness" aspect of
mathematical reasoning isn't really valued by a programmer, which represents
a chasm between programming practices and how a mathematician is expected to
tackle problems. And this means that the thought processes may be seen as
very similar, but the details in which programming has been drifting away
from the correctness aspect of math have since made them considerably
different.


Rui Maciel

Bartc

7/21/2011 11:28:00 AM

0

"Rui Maciel" <rui.maciel@gmail.com> wrote in message
news:4e279ec1$0$31827$a729d347@news.telepac.pt...


> So, to sum things up, programming is in fact applied math and therefore a
> programmer needs to employ mathematical reasoning to develop software.
> Yet,
> as no one bothers to prove their code to be correct, either by
> incompetence
> or by simply not being able to afford it, the "correctness" aspect of
> mathematical reasoning isn't really valued by a programmer, which
> represents
> a chasm between programming practices and how a mathematician is expected
> to
> tackle problems. And this means that the thought processes may be seen as
> very similar, but the details in which programming has been drifting away
> from the correctness aspect of math have since made them considerably
> different.

Programming is lot more complicated than any mathematical formula I've ever
seen (for example in having a very large number of possible inputs and
expected outputs).

And to prove correctness, don't you need some sort of specification?
(Because if you try and prove two different programs, A and B, which both
happen to be correct, and accidentally get them mixed up, both will pass.
Until you try and use B instead of A!)

In that case, we're back to square one with the specification, which
presumably is itself some sort of program...

--
Bartc

Nick Keighley

7/21/2011 12:11:00 PM

0

On Jul 21, 4:27 am, Rui Maciel <rui.mac...@gmail.com> wrote:


<snip>

> Sometimes it may be overlooked but programming is inherently and
> fundamentally a mathematical endeavour,

well, "Up to a point, Lord Copper"

you might as well say civil engineering is applied mathematics.

[OTH I nearly failed a job interview by saying something along your
lines]


> which basically involves nothing
> else than a set of operators being applied to a set of fields in a specific
> order in order to reach an intended outcome.  

real programmers have to worry about the resources consumed as well


> Following this interpretation,
> any API is nothing more than a set of definitions of a mix of operators and
> sets which a programmer may apply to his sets of data.  With this in mind,
> the answer to your question would be a clear yes, mathematical reasoning is
> as vital to a mathematician as it is to a programmer.  

I've been a fan of proofs of correctness (though this says little as I
don't actually prove programs). Jon Bentley's Progamming Pearls give
an interesting take on this. Even *thinking* about how you would
"informally"[*] prove the program (well function anyway) helps towards
correctness. What are valid arguments (pre-conditions) what is this
loop doing (loop invarient) and when does it stop (termination
condition), and what should the output be (post-condition). A program
is a contract it guarantees certain outputs if-and-only-if certain
guarantees about the input are met.

[*] being a little bit informal is like being a little bit pregnant.
You are either formal or you aren't.

> It is because
> mathematics and programming are the same thing.

bending the definition of programming to near breasking point.


> But then the real world sets in.

it has that nasty habbit.


> The thing is, mathematicians spend their time and energy studying the
> implications of some set of definitions but they also invest a lot of
> themselves trying to prove that the stuff they come up with is correct.  

what mathematicians are trying to do is fundamentally different from
what programmers are trying to do. Mathematicainas are trying to prove
theorums (or conjectures) within some mathematical framework.
Programmers are trying to produce things that do stuff *within highly
constrained tiem frames and resource availability*.

Back to the civil engineers. If they were unconstrained on time scales
and on material usage then building bridges would be easy. "oh bugger
it, just use another 100 tons of steel".


> This mindset is lost in software development, whose approach to the
> mathematical problem of developing a program often ends with providing code
> which only works as expected in very limited circumstances which no one
> knows or cares to know.  Even those who actually care for this sort of
> stuff
> and actually know their onions shy away from this goal, a fact which may be
> represented by Knuth's quote "Beware of bugs in the above code; I have only
> proved it correct, not tried it."  
>
> Meanwhile, the programming world occupies itself hacking together sets of
> instructions which no one actually cares they are proven to be correct, or
> even if they are valid in the conceivable scenarios which they are designed
> to operate.

I think lots of people care. I think we do an adequate job more often
than is appreciated. That plane that landed on the Hudson river came
down in one piece at least partly because some software did the Right
Thing under some very "but that would never happen!" scenario.


> That is, when compared to how a mathematician may tackle a
> problem, programmers don't actually know what they are doing and instead
> embrace the fact that the stuff they create does break and that they can't
> do anything to prevent it.  The disregard for this mathematical correctness
> has reached a level that some programming errors committed by programmers
> are so widespread and so frequent that, instead of trying to make sure that
> the programmer is sufficiently competent to avoid them, they are simply
> embraced as a natural occurrence and technologies have been developed to be
> able to sweep those programming errors under the proverbial rug, which is
> the case of technologies such as garbage collection and sandboxes.

garbage collectors are there for other reasons as well. I think
sandboxes are as well. Not everyone who wants to run programs on your
computer has your best interests in mind.


> And the thing is, this isn't necessarily bad.  Of course, it would be better
> if every piece of softwar ever written would have been developed with enough
> care to be successfully demonstrated to be correct.

I too have this dream.



> Yet, that would mean
> that an ungodly amount of time and energy (and, of course, money) would be
> spent on developing even the smallest program.

I'm not sure it would be as expensive as people sometimes think.


> Although it would save a lot
> of time and energy in some areas (for example, the software security
> business, at least as we know it, would have never existed)

but something like it /would/. Security is a Hard Problem. Proving
something is secure is damn nearly a halting problem.


> it would simply
> be too cost-prohibitive and also time-consuming to develop any piece of
> software.
>
> So, to sum things up, programming is in fact applied math and therefore a
> programmer needs to employ mathematical reasoning to develop software.

I submit that unit testing when properly done is close to automated
correctness proving. :-)



> Yet,
> as no one bothers to prove their code to be correct, either by incompetence
> or by simply not being able to afford it, the "correctness" aspect of
> mathematical reasoning isn't really valued by a programmer, which represents
> a chasm between programming practices and how a mathematician is expected to
> tackle problems. And this means that the thought processes may be seen as
> very similar, but the details in which programming has been drifting away
> from the correctness aspect of math have since made them considerably
> different.

I don't think it drifted. I think it hoist the mainsail and turned
down wind.

The goals are fundamentally different. Yes I think more DbC and so on
would be a damn good idea. I think the educational system could be
improved too. Maybe the people and really critical systems should be
certified.


--
Nick Keighley


August Karlstrom

7/21/2011 1:14:00 PM

0

On 2011-07-21 05:27, Rui Maciel wrote:
> The disregard for this mathematical correctness
> has reached a level that some programming errors committed by programmers
> are so widespread and so frequent that, instead of trying to make sure that
> the programmer is sufficiently competent to avoid them, they are simply
> embraced as a natural occurrence and technologies have been developed to be
> able to sweep those programming errors under the proverbial rug, which is
> the case of technologies such as garbage collection and sandboxes.

....as well as e.g. run-time checks of array bounds and null pointers and
maybe the whole concept of type safety. If the program is correct we
don't need these. But as we all know even the best programmers make
mistakes. It is therefor an important aspect of the programming language
and environment to fail fast in case of programming errors related to
invalid use of memory (and not produce garbage results) and to aid in
locating these errors.

August

--
The competent programmer is fully aware of the limited size of his own
skull. He therefore approaches his task with full humility, and avoids
clever tricks like the plague. --Edsger Dijkstra