Automatic Programming
I’ve given automatic programming a lot of thought over my rather long (i.e. 40 years) experience programming computers. While at Cycorp, I persisted abstract syntax trees for an Turing-complete agent control language into the Cyc knowledge base. I had the idea then that Cyc could thus reason about programs and begin to author portions of them. But the idea did not gain traction with our sponsors nor with Cycorp management, so it languished.
My current thinking about automatic programming (a.k.a program synthesis) is centered on the notion of program composition. This activity is a skill that involves both algorithmic knowledge as well as domain knowledge. I am now building an essential set of agent capabilities to compose Java classes, variables, methods, and statements. These capabilities will be associated with preconditions, input/output bindings, and postconditions. A capability matcher library will find candidate agent capabilities that match the given task preconditions and postconditions via subsumption reasoning. I intend to hand-craft some of these compositions into executable Java programs to build use cases for the essential programming skills required. Note that I am building a program composition facility rather than a task-solving interpreter. What I hope to accomplish is a system that solves a problem by writing a program that, when compiled, performs the given task. This will be much faster to repeatedly execute because the overhead of program composition greatly diminishes once the tasks are well understood (e.g. task variations become program parameters and thus no need to compose a new program).
Earlier in the project I had hoped to postpone this phase until after the bootstrap English dialog system is completed. But I see now that the general facility of skill acquisition will require precondition and postcondition vocabulary. And because all skills will bottom out into the execution of a Java method, I made the decision to precede now with defining these primitives as skills. For representing pre-and-post conditions I am using an elaborated version of RDF, based upon formula-manipulating classes that I previously released for the Incremental Fluid Construction Grammar vocabulary. I added IMPLIES, NOT, OR, and AND logical operators and variables. Today I finished a class that performs canonicalization (i.e. transformation to conjunctive normal form) and hopefully tomorrow I will complete the capability subsumption matcher. Interested readers can follow my source code commits here.
Having a dialog system simplifies automatic programming because Texai will be able to ask for help when required from its mentor, and will not be expected to complete the job on its own. I am resigned to the fact however that initially programming via English dialog will be much more tedious than directly performing the task myself. Until the student exceeds the skill of the mentor, programming this way will be hard.