Exercise 5 (20 points): In class we have defined the Edit Distance between two strings x and y, of

length n and m respectively to be the minimum (weighted) number of insertions, deletions and substitutions

that transform string x to string y. We also demonstrated that assuming different deletion, insertion

and substitution costs for every letter (or pairs of letters), the following dynamic-programming recursion

computes the edit distance between x and y:

D(x(1 . ..i - 1), y(1 . . .j)) + delete(x[i]),

D(x(1 . . .i), y(1 . . . j)) = min D(x(1. . .i), y(1. ..j -1)) + insert(y[j]),

D(x(1 . ..i - 1), y(1 . ..j - 1)) + substitute(x[i], y[j]).

In the above equation x(1. ..i) (resp. y(1. ..j)) is the substring of x (resp. of y) that consists of the first

i (resp. j) symbols appearing in x (resp. y). Also, for symbol a, delete(a), insert(a) correspond to the

cost of deleting or inserting a respecti vely. Finally, for symbols a, b, substitute(a, b) corresponds to the

cost of substituting symbol a with symbol b.

1. (10 points:) Prove or disprove that the edit distance function as defined above is a metric.

2. (10 points:) Find two instantiations of the edit-distance function that are metrics. An instantiation of

the edit distance function is defined by a specific way of allocating costs to operations such as deletions,

insertions and substitutions.