I'm not sure what you mean by 'it will not scale well.' When we humans learn that we make a mistake - we make a note and we hold the correct answer in memory - the next time we're prompted with a similar prompt, we can use our old memories to come up with the correct solution. I just did a simple test for this same exact problem using ChatGPT 3.5:
'Can you reformulate the following problem using Prolog? When you execute the program - what answer do you get? 'Alice has 8 brothers and she also has 5 sisters. How
many sisters does Alice’s brother have?'
Even though it came up with a proper Prolog formulation - it failed to account that Alice is one of the sisters - so I gave it a simple prompt for this and it was able to correct the formulation and come up with the proper solution:
My prompt after ChatGPT gave me an answer of 5: 'Yes but you aren't including Alice in your logic. Shouldn't the correct answer be 6 (since Alice is also a sister)?'
Response:
'You are correct. The correct answer should account for Alice being one of the sisters. Let's adjust the Prolog program to include Alice in the calculation:
% Facts
brothers(alice, 8).
sisters(alice, 5).
% Rules
sisters(Brother, NumSisters) :-
sisters(alice, Num),
NumSisters is Num + 1. % Include Alice herself
% Query
?- sisters(alices_brother, NumSisters).
In this updated Prolog program:
The rule for determining the number of sisters includes Alice herself by adding 1 to the number of sisters Alice has.
When we execute the query ?- sisters(alices_brother, NumSisters). in Prolog, we should get:
NumSisters = 6.
This correctly reflects that each of Alice's brothers has 6 sisters, including Alice herself.
When I prompt it to answer this question using Prolog now, I always get the correct answers no matter which integers I feed in, so it seems like the model is able to generalize after I show it where it's 'reasoning' was wrong. Basically, my suggestion is to get the model to recognize logic puzzles like this and try to formulate them in terms of logic programming queries which it can use and tune in order to come up with correct answers rather than simple auto-associative chain of reason training which current GPT models rely on, but like I said - this is my hypothesis and I believe this would work much better in getting these models to 'generalize' than the current approaches we're using. Hopefully this helps.