// symb ::= 'a' | 't' | 'c' | 'g' // input : nat -> char -> type // output : nat -> char -> type // dist : nat -> nat -> nat -> type // dist(i,o,cost) means the edit distance between // input from position i to the end and // output from position o to the end // is cost // insert costs 100 // delete costs 10 // modify costs 1 // The relation \ttt{ADD(c1,c2,c3)} means that \ttt{c3} is the sum of the // integers \ttt{c1} and \ttt{c2}. // TASK: // Rule 1: \ttt{i} and \ttt{o} are at the end of the respective strings // Use inputdone(?i) and outputdone(?o) to check this. // Rule 2: The characters at \ttt{i} and \ttt{o} are the same // Rule 3: The characters at \ttt{i} and \ttt{o} are not the same (use \ttt{?ichar != ?ochar}) // Rule 4: The character at \ttt{i} is deleted // Rule 5: The character at \ttt{o} is inserted // ---------------------------------------------------------------------- input(zero(),'a'). input(succ(zero()),'t'). input(succ(succ(zero())),'c'). output(zero(),'a'). output(succ(zero()),'g'). output(succ(succ(zero())),'c'). output(succ(succ(succ(zero()))),'t'). // identifies the end of the input and output strings (should be equal to the length) outputdone(succ(succ(succ(succ(zero()))))). inputdone(succ(succ(succ(zero())))). // SHOULD BE: (101) (102) (103) (211) (210) (212) (320) (321) (430) ?- dist(zero(),zero(),?c).