A provably correct computer program can be generated using genetic
programming techniques. A desired behavior is used to define a formal
specification. An initial population of programs is created where each
program has a meaning that can be defined using a formalization
technique. A fitness function is applied to measure a distance between
the meaning of a program, i.e., its actual behavior, and the
specification. Any program having a zero value as the measure of distance
between the meaning of the program and the specification is determined to
be provably correct. After the fitness of some or all of the programs in
the current generation of programs has been computed, a provably correct
program has not yet been found in the current generation, mutation and/or
crossover techniques are performed on at least some of the fittest
individuals in the current generation to create the programs of a next
generation.