local m={}m.__eq=function(m,B)return m[1]==B[1]and m[2]==B[2]end m.__lt=function(m,B)if m[1]==B[1]then return m[2]<B[2]else return m[1]<B[1]end end m.__le=function(m,B)return m<B or m==B end local function B(B,D)local X={B;D}return setmetatable(X,m)end local function D(m,D)if#m~=#D then error("\067\097\114\100\105\110\097\108\105\116\121 \109\105\115\109\097\116\099\104 \098\101\116\119\101\101\110 \108\101\102\116 \097\110\100 \114\105\103\104\116 \097\114\114\097\121\115\033",2)end local X={}for h=1,#m,1 do X[h]=B(m[h],D[h])end return X end return{Duple=m;new=B;directSum=D}
local Duple = {}
Duple.__eq = function (left, right)
    return left[1] == right[1] and left[2] == right[2]
end

Duple.__lt = function (left, right)
    if left[1] == right[1] then
        return left[2] < right[2]
    else
        return left[1] < right[1]
    end
end

Duple.__le = function (left, right)
    return left < right or left == right
end

local function dupleFromTwoInputs(left, right) 
    local result = { left, right }

    return setmetatable(result, Duple)
end

local function directSum(left, right)
    if #left ~= #right then
        error("Cardinality mismatch between left and right arrays!", 2)
    end

    local result = {}

    for i = 1, #left do
        result[i] = dupleFromTwoInputs(left[i], right[i])
    end

    return result
end

return {
    Duple = Duple,
    new = dupleFromTwoInputs,
    directSum = directSum
}