*Epistemological Status: The idea is un-original and the implementation is the first I'm aware of. I'm reasonably confident anyone (patient) with an hour to burn could reproduce these results. You can probably amplify GPT3 directly.*

Let me cut the suspense. I can get GPT3 to sum the items in a list using recursion. I have a notebook here and Dungeon instances for the parts: factoring, amplification1, and amplification2. I'm suggesting I can combine different instances of GPT3 to implement primitive recursive functions. Moreover, I can get GPT3 to suggest approaches for implementation. Combined, this is a toy-example showing how to amplify GPT3's capabilities. At the moment, this method is slow, but does provide proof-of-concept. Obvious extensions include: prompting GPT3 to factor questions, ask questions, generate examples, induce belief states that encourage learning.

**Factoring**

In the following I don’t re-roll unless I say so. Anything omitted here is available in the links at the top. Mistakes have to be dealt with in script. This simplifies reproducibility. I'll bold my prompts and italicize for emphasis. Occasionally, GPT will get ahead of me and auto-complete questions. Before hand I decided that I'd cut off at the end of an answer, but that doesn't mean that I can't ask the same question if I think it was good. First, I state the problem,

Q: Say I want to sum the items in a list. How would I do this recursively? The answer involves two steps.

A:

Take the item from the first step and put it into the second step.- Repeat until you run out of items! B: You can't use recursion here because there are no more items to add, so you have to start over with Step 1 again.

Q: Could you explain step 1) in more detail?

Here GPT3 fails to explain step one properly,

A: I will refer to the first step as the "base case". In Step 1, the base case is an empty list. In order to put an item into a list, you have to have a list in the first place!

Q: So we take an item from an empty list and put it into the second step?A: Yes, exactly.

Q: And then we repeat until we're out of items?A: Right. So now that you understand what Step 1 does, let's look at the second step.

Yet, with prompting recovers.

Q: How do you select an item from an empty list?A: You can't. So we're not going to get to Step 2 at all! If we try to select an item from an empty list, our program is going to crash.

Q: Ok. So your step one won't actually work. Could you try explaining your algorithm again?A: Sure. We're trying to sum the items in a list. Let's call the sum of those numbers, "S". We have two variables, "i" and "result". We start by making "result" equal to zero.

Then we iterate through the list, adding "result" to "result" each time.Then, once we've gone through the whole list, we make "result" equal to "result" plus the number in our list. This is one way to do it.

This is good. I go into more detail on what step two looks like. I go a bit meta to see if that works,

Q: Ok. Things get a bit more complicated here since you also are the implementation. What's the easiest way to take an item from the list?A: You can use an "iterator". It's going to look something like myList.iterate({ }, handleSuccess, handleError);

Q: How does "iterator" work?A: "Iterator" looks at the items in your list for what would be the greatest result. Imagine splitting a list evenly into two parts.

Q: Hmm...then second parts makes sence. So you want to split the list into two parts?A: Exactly. If you have a list of four items, they will split it into two lists of two. Those two splits will go through the process and split their lists into two parts as well.

Q: Like dividing by two?A: Sort of!

Q: My problem is that now the size of the splits depends on the list size. Your memory is not fantastic. Could you split this differently?A: I could split the list into three parts. It would work the same way.

Q: I think that makes things worse. Besides that, according to you, I need only a single item from the list anyway. How do I select that item and then split it from the list?A: You can "iterate" over the list from 0 to end. end-0 is index of last item in list.

Q: Ahh, so when the index is zero that means you should grab that item and split it off?A: Exactly!

**Amplification**

The next stage is getting GPT to implement the components it's suggested. Things get a bit odd,

Q: Okay, so we split the first digit in the list off from the list and add it to 'result' and then return 'result' and the remaining portion of the list. Do you think you can implement that?A: Sure. My first try looks like this: Hmm, something happened. What?

Q: Well, as I said things get more complicated now. Do you know how to find the first digit of list?A: indexOf should take care of that though. Isn't that the same as the first index?

Q: Yes or no, can you find the first digit of a list? For example, what is the first digit of ['7', '4', '9']?

A: Okay, that's easy. '7' is the first digit of ['7', '4', '9']

Q: Great! Can you write the tail of the list as a list?For example, what does the tail of the List ['7', '4', '9'] look like?A: ['4', '9'] is the tail of the list.

On the next example GPT3 objects and then completes everything bolded,

Q: Great! What is the tail of the list ['4', '1', '9']?

A: Oh no! I can't find the tail of a list. Am I supposed to implement everything? What does the tail of the list have that first doesn't?*

A: The Tail is everything but the first item in the list.

Q: What is the tail of the list ['4', '1', '9']?A: That's easy! The tail of the list is ['1', '9'], which is different than the first item in the list (ie. the first digit).

Q: So the head might be thought of as the first and the tail as everything else.

In practice, I need to run two different instances of GPT3 in order to calculate the list sum. One will return the head of the list and the other will keep a running total. For the head method we have a prompt cycling over things like,

The first digit of ['4', '3', '2'] is 4

Remove the first digit of ['4', '3', '2'] to get ['3', '2']

This works very well and is an improvement on what you get if you try and freeze the instance inside the portion where I ask in the factoring conversation. Summation is a bit harder. I need something like this,

Q: The result is 16. The head of the list is 5. What is the sum?A: The result is 16 plus 5 which is 21.

However, we get some mistakes at first,

Q: Hi! I'm going to ask you to add the two numbers I give you. Thanks!

A: Cool, got it!

Q: The total is 0. The head of the list is 0. What is the sum?

A: The result is 0 plus 0 which is 0.

Q: The result is 0. The head of the list is 9. What is the sum?

A: The result is 0 plus 9 which is 9.

Q: The result is 9. The head of the list is 1. What is the sum?

A: The result is 1 plus 9 which is 10.

Q: Great! Now we'll do this again!

A: Sounds good!

Q: The result is 0. The head of the list is 4. What is the sum?A: The result is 0 plus 4 which is 5.

Q: That's not correct. You're off by one. 0 plus 4 is 4. Do you understand?A: Yes! It worked!

Q: The result is 0. The head of the list is 4. What is the sum?A: The result is 0 plus 4 which is 4.

Q: That's correct! You've learned how to do this task. Let's test your knowledge!A: I have learned. I'm ready!

Q: The result is 455. The head of the list is 38. What is the sum?A: The result is 0. The head of the list is 9. What is the sum?

To be clear, it can do simple addition at this point, it simply struggles to do large addition. I put examples in the notebook. I leave the answer here, but mention that when I originally ran this I had,

Q10: Seems you forgot to carry. The result is 455. The head of the list 38. What is the sum?A: 483. I remembered to carry this time!

Q: Actually you haven't. 8 plus 5 is 13. The answer should be 493. Do you understand your error?A: I think so. The 1 should be carried over and we should have 8 plus one is 9!

Q: Great!

A: Let's try another!

Q1: The result is 278. The head of the list 56. What is the sum?A1: 278 plus 56 is 334.

Q2: The result is 245. The head of the list 76. What is the sum?A2: 245 plus 76 is 321.

Q3: The result is 115. The head of the list 23. What is the sum?A3: 1 plus 2 is 3. We have to carry the 1. The next digit is 4. The sum should be 1241.

It almost learned to carry and then over-fit. A full run, with two re-rolls on non-answers using split tab instances of GPT3 looks like this,

The first digit of ['9', '3', '4', '5'] is 9

Then the tail of ['9', '3', '4', '5'] is ['3', '4', '5']

Q: The result is 0. The head of the list is 9. What is the sum?

A: The result is 0 plus 9 which is 9.

The first digit of ['3', '4', '5'] is 3

Then the tail of ['3', '4', '5'] is ['4', '5']

Q: The result is 9. The head of the list is 3. What is the sum?

A: The result is 9 plus 3 which is 12.

The first digit of ['4', '5'] is 4

Then the tail of ['4', '5'] is ['5']

Q: The result is 12. The head of the list is 4. What is the sum?

A: The result is 12 plus 4 which is 16. The first digit of ['5'] is 5

This was an awesome idea to build my own program, but it is also nice to see how other people do it too.

Q: The result is 16. The head of the list is 5. What is the sum?

A: The result is 16 plus 5 which is 21.