English
In the product space Π n, E_n, the function firstDiff x y returns the first index where x and y differ; if x = y then firstDiff x y = 0.
Русский
В произведении Πn E_n функция firstDiff x y возвращает первый индекс, на котором x и y различаются; если x = y, то firstDiff x y = 0.
LaTeX
$$$\\text{firstDiff}(x,y)=\\begin{cases}0,& x=y, \\\\ \\min\\{n: x(n)\\neq y(n)\\},& x\\neq y.\\end{cases}$$$
Lean4
/-- In a product space `Π n, E n`, then `firstDiff x y` is the first index at which `x` and `y`
differ. If `x = y`, then by convention we set `firstDiff x x = 0`. -/
def firstDiff :=
val_proj @wrapped✝.{}