YES Problem: flatten(nil()) -> nil() flatten(unit(x)) -> flatten(x) flatten(++(x,y)) -> ++(flatten(x),flatten(y)) flatten(++(unit(x),y)) -> ++(flatten(x),flatten(y)) flatten(flatten(x)) -> flatten(x) rev(nil()) -> nil() rev(unit(x)) -> unit(x) rev(++(x,y)) -> ++(rev(y),rev(x)) rev(rev(x)) -> x ++(x,nil()) -> x ++(nil(),y) -> y ++(++(x,y),z) -> ++(x,++(y,z)) Proof: Matrix Interpretation Processor: dim=3 interpretation: [1 0 1] [rev](x0) = [1 0 1]x0 [0 1 0] , [++](x0, x1) = x0 + x1 , [1 1 1] [0] [unit](x0) = [1 1 1]x0 + [1] [0 0 0] [1], [1 0 0] [flatten](x0) = [0 1 0]x0 [0 1 0] , [0] [nil] = [1] [1] orientation: [0] [0] flatten(nil()) = [1] >= [1] = nil() [1] [1] [1 1 1] [0] [1 0 0] flatten(unit(x)) = [1 1 1]x + [1] >= [0 1 0]x = flatten(x) [1 1 1] [1] [0 1 0] [1 0 0] [1 0 0] [1 0 0] [1 0 0] flatten(++(x,y)) = [0 1 0]x + [0 1 0]y >= [0 1 0]x + [0 1 0]y = ++(flatten(x),flatten(y)) [0 1 0] [0 1 0] [0 1 0] [0 1 0] [1 1 1] [1 0 0] [0] [1 0 0] [1 0 0] flatten(++(unit(x),y)) = [1 1 1]x + [0 1 0]y + [1] >= [0 1 0]x + [0 1 0]y = ++(flatten(x),flatten(y)) [1 1 1] [0 1 0] [1] [0 1 0] [0 1 0] [1 0 0] [1 0 0] flatten(flatten(x)) = [0 1 0]x >= [0 1 0]x = flatten(x) [0 1 0] [0 1 0] [1] [0] rev(nil()) = [1] >= [1] = nil() [1] [1] [1 1 1] [1] [1 1 1] [0] rev(unit(x)) = [1 1 1]x + [1] >= [1 1 1]x + [1] = unit(x) [1 1 1] [1] [0 0 0] [1] [1 0 1] [1 0 1] [1 0 1] [1 0 1] rev(++(x,y)) = [1 0 1]x + [1 0 1]y >= [1 0 1]x + [1 0 1]y = ++(rev(y),rev(x)) [0 1 0] [0 1 0] [0 1 0] [0 1 0] [1 1 1] rev(rev(x)) = [1 1 1]x >= x = x [1 0 1] [0] ++(x,nil()) = x + [1] >= x = x [1] [0] ++(nil(),y) = y + [1] >= y = y [1] ++(++(x,y),z) = x + y + z >= x + y + z = ++(x,++(y,z)) problem: flatten(nil()) -> nil() flatten(unit(x)) -> flatten(x) flatten(++(x,y)) -> ++(flatten(x),flatten(y)) flatten(++(unit(x),y)) -> ++(flatten(x),flatten(y)) flatten(flatten(x)) -> flatten(x) rev(++(x,y)) -> ++(rev(y),rev(x)) rev(rev(x)) -> x ++(x,nil()) -> x ++(nil(),y) -> y ++(++(x,y),z) -> ++(x,++(y,z)) Matrix Interpretation Processor: dim=3 interpretation: [rev](x0) = x0 , [++](x0, x1) = x0 + x1 , [1 0 0] [0] [unit](x0) = [0 0 1]x0 + [0] [0 0 1] [1], [1 0 1] [flatten](x0) = [0 0 0]x0 [0 0 0] , [0] [nil] = [0] [0] orientation: [0] [0] flatten(nil()) = [0] >= [0] = nil() [0] [0] [1 0 1] [1] [1 0 1] flatten(unit(x)) = [0 0 0]x + [0] >= [0 0 0]x = flatten(x) [0 0 0] [0] [0 0 0] [1 0 1] [1 0 1] [1 0 1] [1 0 1] flatten(++(x,y)) = [0 0 0]x + [0 0 0]y >= [0 0 0]x + [0 0 0]y = ++(flatten(x),flatten(y)) [0 0 0] [0 0 0] [0 0 0] [0 0 0] [1 0 1] [1 0 1] [1] [1 0 1] [1 0 1] flatten(++(unit(x),y)) = [0 0 0]x + [0 0 0]y + [0] >= [0 0 0]x + [0 0 0]y = ++(flatten(x),flatten(y)) [0 0 0] [0 0 0] [0] [0 0 0] [0 0 0] [1 0 1] [1 0 1] flatten(flatten(x)) = [0 0 0]x >= [0 0 0]x = flatten(x) [0 0 0] [0 0 0] rev(++(x,y)) = x + y >= x + y = ++(rev(y),rev(x)) rev(rev(x)) = x >= x = x ++(x,nil()) = x >= x = x ++(nil(),y) = y >= y = y ++(++(x,y),z) = x + y + z >= x + y + z = ++(x,++(y,z)) problem: flatten(nil()) -> nil() flatten(++(x,y)) -> ++(flatten(x),flatten(y)) flatten(flatten(x)) -> flatten(x) rev(++(x,y)) -> ++(rev(y),rev(x)) rev(rev(x)) -> x ++(x,nil()) -> x ++(nil(),y) -> y ++(++(x,y),z) -> ++(x,++(y,z)) Matrix Interpretation Processor: dim=3 interpretation: [1 0 0] [rev](x0) = [0 0 1]x0 [0 1 0] , [++](x0, x1) = x0 + x1 , [1 0 0] [flatten](x0) = [1 0 0]x0 [0 0 0] , [1] [nil] = [0] [0] orientation: [1] [1] flatten(nil()) = [1] >= [0] = nil() [0] [0] [1 0 0] [1 0 0] [1 0 0] [1 0 0] flatten(++(x,y)) = [1 0 0]x + [1 0 0]y >= [1 0 0]x + [1 0 0]y = ++(flatten(x),flatten(y)) [0 0 0] [0 0 0] [0 0 0] [0 0 0] [1 0 0] [1 0 0] flatten(flatten(x)) = [1 0 0]x >= [1 0 0]x = flatten(x) [0 0 0] [0 0 0] [1 0 0] [1 0 0] [1 0 0] [1 0 0] rev(++(x,y)) = [0 0 1]x + [0 0 1]y >= [0 0 1]x + [0 0 1]y = ++(rev(y),rev(x)) [0 1 0] [0 1 0] [0 1 0] [0 1 0] rev(rev(x)) = x >= x = x [1] ++(x,nil()) = x + [0] >= x = x [0] [1] ++(nil(),y) = y + [0] >= y = y [0] ++(++(x,y),z) = x + y + z >= x + y + z = ++(x,++(y,z)) problem: flatten(nil()) -> nil() flatten(++(x,y)) -> ++(flatten(x),flatten(y)) flatten(flatten(x)) -> flatten(x) rev(++(x,y)) -> ++(rev(y),rev(x)) rev(rev(x)) -> x ++(++(x,y),z) -> ++(x,++(y,z)) Matrix Interpretation Processor: dim=1 interpretation: [rev](x0) = 4x0 + 1, [++](x0, x1) = x0 + x1 + 4, [flatten](x0) = x0, [nil] = 0 orientation: flatten(nil()) = 0 >= 0 = nil() flatten(++(x,y)) = x + y + 4 >= x + y + 4 = ++(flatten(x),flatten(y)) flatten(flatten(x)) = x >= x = flatten(x) rev(++(x,y)) = 4x + 4y + 17 >= 4x + 4y + 6 = ++(rev(y),rev(x)) rev(rev(x)) = 16x + 5 >= x = x ++(++(x,y),z) = x + y + z + 8 >= x + y + z + 8 = ++(x,++(y,z)) problem: flatten(nil()) -> nil() flatten(++(x,y)) -> ++(flatten(x),flatten(y)) flatten(flatten(x)) -> flatten(x) ++(++(x,y),z) -> ++(x,++(y,z)) Matrix Interpretation Processor: dim=3 interpretation: [++](x0, x1) = x0 + x1 , [1 0 1] [flatten](x0) = [0 1 0]x0 [0 1 0] , [0] [nil] = [1] [1] orientation: [1] [0] flatten(nil()) = [1] >= [1] = nil() [1] [1] [1 0 1] [1 0 1] [1 0 1] [1 0 1] flatten(++(x,y)) = [0 1 0]x + [0 1 0]y >= [0 1 0]x + [0 1 0]y = ++(flatten(x),flatten(y)) [0 1 0] [0 1 0] [0 1 0] [0 1 0] [1 1 1] [1 0 1] flatten(flatten(x)) = [0 1 0]x >= [0 1 0]x = flatten(x) [0 1 0] [0 1 0] ++(++(x,y),z) = x + y + z >= x + y + z = ++(x,++(y,z)) problem: flatten(++(x,y)) -> ++(flatten(x),flatten(y)) flatten(flatten(x)) -> flatten(x) ++(++(x,y),z) -> ++(x,++(y,z)) Matrix Interpretation Processor: dim=1 interpretation: [++](x0, x1) = 2x0 + x1 + 1, [flatten](x0) = 2x0 orientation: flatten(++(x,y)) = 4x + 2y + 2 >= 4x + 2y + 1 = ++(flatten(x),flatten(y)) flatten(flatten(x)) = 4x >= 2x = flatten(x) ++(++(x,y),z) = 4x + 2y + z + 3 >= 2x + 2y + z + 2 = ++(x,++(y,z)) problem: flatten(flatten(x)) -> flatten(x) Matrix Interpretation Processor: dim=3 interpretation: [1 1 0] [0] [flatten](x0) = [0 0 0]x0 + [1] [0 0 0] [0] orientation: [1 1 0] [1] [1 1 0] [0] flatten(flatten(x)) = [0 0 0]x + [1] >= [0 0 0]x + [1] = flatten(x) [0 0 0] [0] [0 0 0] [0] problem: Qed