Talk:Primitive recursive function

message: :[about the diagonal argument:] Note that this argument can be applied to any class of functions that can be enumerated in this way. (One might think this implies that any explicit list of the computable functions cannot be complete, but that's false because of the undecidability of the Halting Problem.)
(One might think this implies that any explicit list of the computable functions cannot be complete, but that's false because of the undecidability? of the Halting Problem.)''
I changed this back, clarifying that we only talk about total computable functions here. Indeed, an explicit (in the sense of recursively enumerable) list of total computable functions can never be complete, as the diagonal argument shows.
It is possible to have a complete explicit list of partial computable functions though. I guess that's the misunderstanding. 199.17.234.96
I don't understand what the point of this 'diagonal argument' is. To show that there are computable functions that are not Primitive Recursive one just exhibits one -- such as Ackermann (as is written at the end of the article). Does anyone have an the objection to snipping this bit out? --Sam Staton 15:56, 23 May 2006 (UTC)
thread_title: Diagonal argument

message: :Many of the functions normally studied in number theory, and approximations to real-valued functions, are primitive recursive, such as addition, division, factorial, exponential, finding the nth prime, and so on (Brainerd and Landweber, 1974).
It hurts to read this sentence. Fredrik Johansson 00:53, 30 April 2006 (UTC)
replies: text: Fixed, I think. Adam (talk) 04:02, 23 October 2008 (UTC)
thread_title:  Sentence structure 

message: Whoever is in charge of this article should make up his/her mind whether he/she is using zero-based numbering or one-based numbering for lists of functions and for their arguments. JRSpriggs 03:14, 30 July 2006 (UTC)
replies: text: Since no one else did anything, I converted the article to consistent one-based numbering. Please let us keep it that way. JRSpriggs 03:57, 3 August 2006 (UTC)
thread_title:  Zero-based or One-based numbering? 

message: I dont know how I landed up here but this doesnt makes sense !
:"The primitive recursive functions are defined using primitive recursion and composition as central operations and are a strict subset of the recursive functions (recursive functions are also known as the computable functions)." 
What is primitive recursion? the article becomes denser by each word :( 122.169.148.119 (talk) 20:32, 25 November 2007 (UTC)
replies: text: Sorry, but this is a difficult concept. The definition is in the first section after the lead. However, I could over-simplify it by saying that primitive recursive functions are those which can be calculated within a predetermined number of steps (which depends on inputs). JRSpriggs (talk) 03:35, 26 November 2007 (UTC)
thread_title:  Nonsense?

message: This article lacks concise and comprehensive definitions of what it is trying to describe. 
Declaring relationships or information that may be relevant to a topic without precisely defining that topic leads to the obfuscation of and abandonment of concise definition.
If you feel that the material is a difficult concept, then please abandon the approach of providing strict declarative knowledge, which really says nothing precisely about a topic at all, only relationships relevant to that topic. 
Since this particular topic is of interest to computer scientists, a strictly mathematical approach is of good use but not sufficient. I look forward to seeing an updated page. 14:39, 9 May 2008 —Preceding unsigned comment added by Org322001 (talk • contribs) 
---
The simple one-accumulator register machine might offer a (non-strict) example of the five axioms. In this example the axioms boil down into a few primitive machine operations:  
:1 Constant function: 0 is primitive recursive: CLEAR r, (abbreviated CLR r) where "r" is any register that the machine has access to, symbolized as 0 --> r.
::Suppose we have four registers A, P, Q, R. Then CLR P will cause the contents of register P to be 0 (in other words, P will be empty of counts): 0 --> P. Registers A, Q and R will be unaffected.
:2 Successor function: INCREMENT r (abbreviated: INC r)
:: Example: INC P will add one count to register P, the contents symbolized with brackets around the register (cf. Boolos-Burgess-Jeffrey symbolism): [P]+1 --> P
:3 Projection function: i.e. we have access to any register in the machine. We need to distinguish the two types: COPY and MOVE. COPY r1,r2 i.e. copy the contents of r2 into r1. This is easier to see if we restrict our model to a machine with a special "accumulator" register that we call "A", and the instruction "LOAD r" ( LDA r) that does the following: [r] --> A.
:: Example: LDA P, symbolized [P] --> A
:: Example: LOAD A,P symbolized [P] --> A 
:4 Composition: STOREA r (abbreviated: STA r). COPY the contents of A -- the contents may be the result of many operations -- into any register (including itself); the contents of A is left untouched. 
:5 Primitive recursion: The IF ... EQUALS ... THEN GOTO ... operation. We need any two of the following 3 versions:
:* 5.1: IF the contents of register A EQUALS the contents of register r, then JUMP_TO instruction 7 (abbreviated: JE A,r or perhaps, JEA r)  
:* 5.2: IF the contents of register A is not equal to the contents of register r then GOTO instruction x (abbreviated: JNE A,r,x or perhaps JNEA r,x.  7: Jump if A is Zero to instruction 7)
:* 5.3: "Unconditional jump" (JUMP_TO instruction x, appreviated J x ).
Primitive recursion actually involves incrementing too, so really, primitive recursion is an IF-THEN LOOP that counts up until the IF THEN is satisfied, at which point the function either terminates (HALT) or leaps to another instruction.
:Example: ADD the contents of register P to Q and deposit the result in R
:: 1 CLEAR A ;register A is a counter to be used in the two recursions
:: 2 CLEAR R :register R is where the result will appear
:: ;First primitive recursive loop -- copies the count in register P into result-register R:
::: ;1st primitive-recursive loop:
:::: 3 JEA P,7 ;Is (contents of) A equal to (contents of) P? If so then go to instruction 7 else continue to next instruction.
:::: 4 INC R
:::: 5 INC A
:::: 6 JUMP_TO 3
:: 7 CLEAR A ;A will again be used as a counter to add the counts in Q to the counts in R
::: ;2nd primitive-recursive loop:
:::: 8 JEA Q,12 ;Is A equal to Q? If so then go to instruction 12 else continue to next instruction.
:::: 9 INC R
:::: 10 INC A
:::: 11 JUMP_TO 8
:: 12 HALT ; [R]=[P]+[Q] 
The above is only one version of ADD -- maybe the reader can suggest a better one -- but it illustrates the point. I don't know whether something like this would help a reader or not. One thing that comes out of it is that we know from Turing equivalence that other "instruction sets" are sufficient. Indeed, there are other sufficient axiom sets besides the "Peano set" given in this article. Who is it ... Laszlo Kalmar (1943) it was ... who originated another set similar to the counter machine (i.e. his set starts with constant 1, has INCREMENT, a subtraction (DECREMENT) and the finite sum and finite product -- these are where recursion appears (cf Kleene 1952/1971:285 and p. 526 citing Kalmar 1943). Bill Wvbailey (talk) 16:56, 9 May 2008 (UTC)
thread_title:  Critique/Suggestions To Improve the Article 

message: I'm no expert here, but shouldn't the symbol for proper subtraction be ⊥ (U+22A5, 'Up tack') or ⟂ (U+27C2, 'perpendicular'), not ┴ (U+2534, 'Box drawing light up and horizontal', currently used)? I don't expect box drawings be used as a mathematical expression... -- あるうぃんす (talk) 14:45, 14 September 2013 (UTC)
replies: text: Actually the symbol I have seen is similar to  3 \div 5 = 0 \,  except that the dot below the line is removed. JRSpriggs (talk) 09:26, 15 September 2013 (UTC)

text: Yes, this symbol ∸ , derived from Arial Unicode MS symbol code: 2238 Unicode (Hex). Bill Wvbailey (talk) 20:54, 15 September 2013 (UTC)
replies: text: Thanks to Wvbailey for the character. I put it into the article. JRSpriggs (talk) 09:16, 16 September 2013 (UTC)
thread_title:  symbol for proper subtraction (#Some common primitive recursive functions ) 

message: I found the following on [wolfram](http://mathworld.wolfram.com/PrimitiveRecursiveFunction.html):
"As first shown by Meyer and Ritchie (1967), do-loops (which have a fixed iteration limit) are a special case of while-loops. A function that can be implemented using only do-loops is called primitive recursive. (In contrast, a computable function can be coded using a combination of for- and while-loops, or while-loops only.) Examples of primitive recursive functions include power, greatest common divisor, and p_n(the function giving the nth prime). "
This definition might just be a name clash, but if it is equivalent, it does get a point across much more quickly and more layman-friendly.  But I am reluctant to edit the article as I do not have the expertise. What is your opinion JSpriggs? I don't think we should remove information, but if this 'primitive recursive function' is the same as that 'primitive recursive function' then we should mention that early on. Also, if this definition is added, we should elaborate what we mean by fixed iteration limit more precisely. JimCrayne (talk) 02:58, 2 February 2015 (UTC)
replies: text: This is not a name clash, and the two definitions are equivalent, a soon as one has proved that the programming language which is used computes primitive functions (Church thesis). More precisely, if, for each loop of the program, there is a primitive function which can upper bound the number of iterations before entering the loop, then the function computed by the program is primitive. There is a related theorem, which is also rather intuitive, and may help to understand complexity theory: A recursive function is primitive if and only if its computation time is upperbounded by a primitive function of the size of the input. The relationship is the following: Starting for a program, compute first a bound B of the execution time; then transform all while loops into do loops of the form "for i = 1 to B do". The practical consequence is that, as soon as you have computed the worst-case complexity of an algorithm, you know that it computes a primitive function. IMO, the article should insist on these results, as, except for specialists of recursive functions, there are the main properties of primitive recursive functions that deserve to be known by mathematicians and computer scientists. I have learn this a long time ago in a book, the name of which I do not remember. Therefore editing the article accordingly would take too much time for me. Note also that I have suggested before (#Definition) a modification of the lead that is similar to this. D.Lazard (talk) 10:10, 2 February 2015 (UTC)
replies: text: Yes, I think you two have the right idea of what a primitive recursive function is. However, I would rather that you make the change than that I make it because I am happy with the present version. You can change it to make it clear to yourselves and then I will make sure that it is still technically correct. JRSpriggs (talk) 04:24, 3 February 2015 (UTC)
thread_title:  More intuitive definition ? 

message: The numbered list of functions from Addition to Logarithm had several inconsistencies and typos and unnecessary elements; I fixed several of them as a minor edit.  This last one I left as a major edit because I'm not at all sure if I've preserved the original intent -- the original text
: "b divides a" [ a | b ]: If the remainder ( a, b )=0 then [ a | b ] else b does not divide a "evenly"
isn't even grammatically sensible, and seems to be confused about which of a and b is the potential divisor.  I rewrote it to
: a | b: (a divides b): If b=k×a for some k then 0 else 1
under the assumption that it was intended to be the (t=0,f=1) representation function for the usual "a divides b" predicate.
There are two (evidently different) functions both written as a×b in this list.  Perhaps this needs addressing.
I left the final item
: lo(x, y): logarithm of x to the base y
untouched, but since "logarithm" is understood by default to be real-valued, this needs a clarification of what it means.  My best guess would be that lo(576, 2) = 6, which makes it similar to, but not identical to, the (a)i function earlier in the list.  Joule36e5 (talk) 06:43, 6 April 2015 (UTC)
thread_title:  List of p.r. functions 

message: In the introduction we read:
:In fact, it is difficult to devise a computable function that is not primitive recursive.
Actually I think it is quite easy: Each non-total computable function is not primitive recursive since primitive recursive functions are total. So should we change it to the following?
:In fact, it is difficult to devise a total computable function that is not primitive recursive.
--Jobu0101 (talk) 11:13, 22 April 2015 (UTC)
replies: text: Good point. I changed "computable" to "total recursive" in that sentence. JRSpriggs (talk) 04:56, 23 April 2015 (UTC)
thread_title:  Computable function that is not primitive recursive