1
   

"Basic" functions in the theory of computation

 
 
cndcnd
 
Reply Fri 15 Oct, 2004 03:09 am
I wanted to know if, according to the theory of computation, there is a limited set of functions (like NOT, AND, OR) that can be considered basic, meaning that any computation can be decomposed as a combination of such functions. Also, assuming the answer is yes, I would like to know what is the most limited set of such functions.

Thank you
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 808 • Replies: 8
No top replies

 
stuh505
 
  1  
Reply Fri 15 Oct, 2004 08:09 am
{NOT, AND, OR} can be used to represent any boolean function.

There are other basic ones like {XOR, NAND, NOR}.

A NAND gate is like an AND gate with a NOT gate after it in series; a NOR gate is an OR gate with a NOT gate after it.

NAND and NOR gates are very easy to construct for circuits, and ANY boolean function can be constructed out of just NAND or just NOR gates.

So the most limited set would be {NAND} or {NOR}.
0 Replies
 
g day
 
  1  
Reply Fri 15 Oct, 2004 05:11 pm
For boolean logic I think stuh has given your answer. The set of operators is such that only 2 or 3 non colinear elements of the set are needed to generate all the rest.

In real life I find C as a programming language can do just about anything you like, sometime better than assembler or ADA even. For instance the writeln("hello world") procedure in Pascal can't be written in Pascal - as it takes a variable number of parameters. C can do just about anything, timed functions, system calls, deliver an operating system, device drivers, true pointers and addressing to multiple levels of indirection, cast data to code or vice versa.
0 Replies
 
stuh505
 
  1  
Reply Sun 24 Oct, 2004 01:30 pm
g__day,

I don't think boolean functions have much relevance to programming.

however, since you bring it up...c is a very inefficient language (in terms of programming implementation, as opposed to execution or compiled file size), and although it can be adapted to do just about anything...this often takes a level of skill that most people aren't capable of

there are other languages that offer much greater efficiency at complex tasks such as windows GUI, graphics, and reflection, and networking...without any reduced efficiency at the basic tasks...and with basically the same universal capabilities to do anything. I'm fond of c#, and although I haven't used it much, I believe java would fall into this category also.
0 Replies
 
markr
 
  1  
Reply Sun 24 Oct, 2004 04:40 pm
stuh505,

How different is C# from C?

How much of the greater efficiency that you refer to is derived from the language vs. the environment? For instance, with MS Visual (pick a language), there is a lot of stuff (GUI, for instance) that the developers' environment provides that really has nothing to do with the base language.
0 Replies
 
stuh505
 
  1  
Reply Sun 24 Oct, 2004 07:48 pm
markr,

the syntax of c# is pretty similar to c++...but a little nicer

I do all of my coding in notepad

in c#, if I want to make a simple message box, it's one line of code. if I want to make a windows form, its a few lines. if I want to do that in c++, its hundreds of lines...and extremely confusing...and totally pointless to waste my time even trying.

I am really opposed to using any kind of automatic code writing because I like to know exactly what my code is doing...its easier to debug, and its cleaner, and it just feels better...which is why I do all of my coe in notepad or edit plus, which is like notepad except that it highlights functions etc in different colors so they are easier to see. however, it is not even possible for me to code this way in c++ because it can get so complex with windows forms

after only a few weeks of teaching myself c# without using any training or books, just using the msdn online reference library to look up functions, I was able to write some very nice software for a company to extract data out of a database, scan files for their security permissions, and automatically perform upgrades on thousands of databases...this program was using nice windows forms with progress bars and multithreading and error checking.

I was able to do graphics to write a chess program, and spent some time programming in an AI system for it. I had previously spent weeks attempting to display graphics in c++, downloaded many libraries etc, and eventually ended up with a bunch of garbage files and zero success at the graphics in c++

I have used it in a new artificial intelligence program I am working on, to design and build a new kind of text parser, a grammar file interpreter, I have used it to write a chatbot which talks over IRC, I have even used reflections which is built into c# to have the program dynamically write, compile, load, and execute new code on the fly.

all of these are things I could never dream of doing in c++...
0 Replies
 
markr
 
  1  
Reply Mon 25 Oct, 2004 12:27 am
stuh505,

C# sounds pretty cool. However, from what you describe, it seems that a lot of the richness must be derived from a set of well implemented library functions. One line of code for a message box speaks to the libraries, not the language. Trying to do Windows-like graphics with <pick a language> in DOS would be a bitch compared to doing it in Windows. That's not because the language is bad. There's a ton of functionality that is at the disposal of the Windows programmer. I'm not knocking C# (or saying that C++ is better), but a lot (I'd say most) of what makes development more efficient nowadays is the libraries and features of the OS.

Would you say that your bad experience with C++ and graphics was due more to the language or to the implementation of the libraries?
0 Replies
 
stuh505
 
  1  
Reply Mon 25 Oct, 2004 06:38 am
Quote:
from what you describe, it seems that a lot of the richness must be derived from a set of well implemented library functions. One line of code for a message box speaks to the libraries, not the language.


yes, the libraries, of course. but take away the libraries, and what do you have? not much more than a grammar file. the libraries which come standard are what really define the capability of the language

Quote:
Trying to do Windows-like graphics with <pick a language> in DOS would be a bitch compared to doing it in Windows.


in order to write windows-like graphics from DOS, and I assume you mean the old dos from before windows existed, would require writing the majority of windows all over again...so yes, that would be a bitch...but this is not a very practical example

Quote:
a ton of functionality that is at the disposal of the Windows programmer. I'm not knocking C# (or saying that C++ is better), but a lot (I'd say most) of what makes development more efficient nowadays is the libraries and features of the OS.


but c++ isn't a "dos" language...it is usually used in windows. it does have libraries for windows functionality, but they are HORRIBLE. and it's not like somebody is going to ever rewrite the libraries.
0 Replies
 
markr
 
  1  
Reply Mon 25 Oct, 2004 08:58 pm
stuh505 wrote:
the libraries which come standard are what really define the capability of the language


I don't buy that. Those same library functions can be called by an assembly language program. Libraries are toolkits to make development efficient. Often, they are just interfaces to the operating system.
0 Replies
 
 

Related Topics

Evolution 101 - Discussion by gungasnake
Typing Equations on a PC - Discussion by Brandon9000
The Future of Artificial Intelligence - Discussion by Brandon9000
The well known Mind vs Brain. - Discussion by crayon851
Scientists Offer Proof of 'Dark Matter' - Discussion by oralloy
Blue Saturn - Discussion by oralloy
Bald Eagle-DDT Myth Still Flying High - Discussion by gungasnake
DDT: A Weapon of Mass Survival - Discussion by gungasnake
 
  1. Forums
  2. » "Basic" functions in the theory of computation
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.07 seconds on 01/18/2025 at 04:48:07