Texai writes its own Java programs by having an essential set of primitive capabilities that step-by-step can compose Java classes. Each primitive capability has these characteristics:

  • preconditions - the set of semantic formulas that must subsume the corresponding precondition formulas in the commanded task
  • input-roles - the set of variables that are input to the capability
  • output-roles - the set of variables that are populated by the capability
  • postconditions - the set of semantic formulas that must be subsumed by the corresponding postconditions in the commanded task
  • invariant conditions - the set of implication formulas that satisfy the corresponding invariant conditions in the commanded task
  • emit - the ability to emit (i.e. generate) a particular Java source code element or composed element

For example here is a primitive capability for declaring an instance variable in a Java class:

(capability
name: “defineInstanceVariable”
description: “Defines an instance variable having the given name and object type.”
preconditions:
(<rdf:type> ?variable-name <texai:JavaVariableName_NonEmptyCharacterString>)
(<rdf:type> ?object-type <texai:JavaType_CharacterString>)
(<rdf:type> ?variable-comment <texai:JavaComment_CharacterString>)
(<rdf:type> ?variable-invariant-conditions <texai:JavaInvariantConditions_Tuple>)
(implies
(<cyc:memberOfTuple> ?variable-invariant-condition ?variable-invariant-conditions)
(<rdf:type> ?variable-invariant-condition <cyc:CycLFormula>))
input-roles:
(<texai:blRole> ?variable-name “a variable name”)
(<texai:blRole> ?object-type “a type”)
(<texai:blRole> ?variable-comment “a comment”)
(<texai:blRole> ?variable-invariant-conditions “some invariant conditions”)
output-roles:
(<texai:blRole> ?defined-instance-variable “the defined instance variable”)
postconditions:
(<rdf:type> ?defined-instance-variable <texai:org.texai.bl.domainEntity.BLInstanceVariable>)
(<texai:blInstanceVariableName> ?defined-instance-variable ?variable-name)
(<texai:blInstanceVariableType> ?defined-instance-variable ?object-type)
(implies
(<cyc:memberOfTuple> ?variable-invariant-condition ?variable-invariant-conditions)
(<texai:blInstanceVariableInvariantCondition> ?defined-instance-variable ?variable-invariant-condition))
)

Here is a sample task that matches the above capability:

(task
preconditions:
(<rdf:type> <texai:JavaObject_AVariableName> <texai:JavaVariableName_NonEmptyCharacterString>)
(<rdf:type> <texai:JavaObject_AType> <texai:JavaType_CharacterString>)
(<rdf:type> <texai:JavaObject_AComment> <texai:JavaComment_CharacterString>)
(<rdf:type> <texai:JavaObject_SomeInvariantConditions> <texai:JavaInvariantConditions_Tuple>)
(implies
(<cyc:memberOfTuple> ?variable-invariant-condition <texai:JavaObject_SomeInvariantConditions>)
(<rdf:type> ?variable-invariant-condition <cyc:CycLFormula>))
postconditions:
(<rdf:type> ?defined-instance-variable <texai:org.texai.bl.domainEntity.BLInstanceVariable>)
(<texai:blInstanceVariableName> ?defined-instance-variable ?variable-name)
(<texai:blInstanceVariableType> ?defined-instance-variable ?object-type)
(<texai:blInstanceVariableComment> ?defined-instance-variable ?variable-comment)
(implies
(<cyc:memberOfTuple> ?variable-invariant-condition <texai:JavaObject_SomeInvariantConditions>)
(<texai:blInstanceVariableInvariantCondition> ?defined-instance-variable ?variable-invariant-condition))
)

Here are the Java objects that are bound to the task JavaObject terms:

  • texai:JavaObject_AVariableName <–> “testFloat”
  • texai:JavaObject_AType <–> “float”
  • texai:JavaObject_AComment <–> “a test float”

After the defineInstanceVariable capability executes, it creates a BLInstanceVariable Java object that can emit the following Java source code:

/** a test float */

float testFloat;

At this point, only the most primitive composition capabilities are defined. I’ll hand-code English dialog routines that invoke these. Then I hope that Texai can acquire skills and build more complex programs via English dialog.