`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Load Algebra.awf
Load Standard.awf
Branching Array'[!List !Nat][T : Star](
  !Empty_List -> Empty_Array',
  !Construct_List N L -> Construct_Array' (Arrays : Array N (Array' L T)))
Branching Tuple[!List Star](
  !Empty_List -> Empty_Tuple,
  !Construct_List T L -> Construct_Tuple(Head_Tuple : T, Tail_Tuple : Tuple L))
Class Commutative_Tuple{L : !List Star}<Ring_Tuple>
Class Field_Tuple{L : !List Star}<Ring_Tuple>(Inverse_Tuple : Tuple L -> Maybe (Tuple L))
Class Finite_Tuple{L : !List Star}<Ord_Tuple>(All_Tuple : List (Tuple L))
Class Ord_Tuple{L : !List Star}(Compare_Tuple : Tuple L -> Tuple L -> Comparison)
Class Ring_Tuple{L : !List Star}(
  Add_Tuple : Tuple L -> Tuple L -> Tuple L,
  Convert_Tuple : Int -> Tuple L,
  Multiply_Tuple : Tuple L -> Tuple L -> Tuple L,
  Negate_Tuple : Tuple L -> Tuple L)
Class Writeable_Array'{L : !List !Nat}(Write_Brackets_Array'[T : Star]<Writeable T> : Array' L T -> List Char * Logical)
Class Writeable_Tuple{L : !List Star}(Write_Brackets_Tuple : Tuple L -> List Char * Logical)
Instance Commutative{Tuple L}<Commutative_Tuple L>
Instance Commutative_Tuple{!Empty_List[Star]}
Instance Commutative_Tuple{!Construct_List[Star] T L}<Commutative T, Commutative_Tuple L>
Instance Field{Tuple L}<Field_Tuple L>(Inverse = Inverse_Tuple)
Instance Field_Tuple{!Empty_List[Star]}(Inverse_Tuple = Wrap)
Instance Field_Tuple{!Construct_List[Star] T L}<Field T, Field_Tuple L>(
  Inverse_Tuple x = Zip Construct_Tuple (Inverse (Head_Tuple x)) (Inverse (Tail_Tuple x)))
Instance Finite{Tuple L}<Finite_Tuple L>(All = All_Tuple)
Instance Finite_Tuple{!Empty_List[Star]}(All_Tuple = Lift Empty_Tuple)
Instance Finite_Tuple{!Construct_List[Star] T L}<Finite T, Finite_Tuple L>(All_Tuple = Zip Construct_Tuple All All)
Instance Ord{Tuple L}<Ord_Tuple L>(Compare = Compare_Tuple)
Instance Ord_Tuple{!Empty_List[Star]}(Compare_Tuple _ _ = EQ)
Instance Ord_Tuple{!Construct_List[Star] T L}<Ord T, Ord_Tuple L>(
  Compare_Tuple x y = Compare (Pair (Head_Tuple x) (Tail_Tuple x)) (Pair (Head_Tuple y) (Tail_Tuple y)))
Instance Ring{Tuple L}<Ring_Tuple L>(
  Add = Add_Tuple,
  Convert = Convert_Tuple,
  Multiply = Multiply_Tuple,
  Negate = Negate_Tuple)
Instance Ring_Tuple{!Empty_List[Star]}(
  Add_Tuple _ = Id,
  Convert_Tuple _ = Empty_Tuple,
  Multiply_Tuple _ = Id,
  Negate_Tuple = Id)
Instance Ring_Tuple{!Construct_List[Star] T L}<Ring T, Ring_Tuple L>(
  Add_Tuple x y = Construct_Tuple (Add (Head_Tuple x) (Head_Tuple y)) (Add (Tail_Tuple x) (Tail_Tuple y)),
  Convert_Tuple x = Construct_Tuple (Convert x) (Convert x),
  Multiply_Tuple x y = Construct_Tuple (Multiply (Head_Tuple x) (Head_Tuple y)) (Multiply (Tail_Tuple x) (Tail_Tuple y)),
  Negate_Tuple x = Construct_Tuple (Negate (Head_Tuple x)) (Negate (Tail_Tuple x)))
Instance Writeable{Array' N T}<Writeable T, Writeable_Array' N>(Write_Brackets = Write_Brackets_Array')
Instance Writeable{Tuple L}<Writeable_Tuple L>(Write_Brackets = Write_Brackets_Tuple)
Instance Writeable_Tuple{!Empty_List[Star]}(
  Write_Brackets_Tuple _ = Pair (List ("E", "m", "p", "t", "y", "_", "T", "u", "p", "l", "e")) False)
Instance Writeable_Tuple{!Construct_List[Star] T L}<Writeable T, Writeable_Tuple L>(
  Write_Brackets_Tuple x =
    Pair
      (Write'
        (List ("C", "o", "n", "s", "t", "r", "u", "c", "t", "_", "T", "u", "p", "l", "e"))
        (List (Brackets (Head_Tuple x), Brackets (Tail_Tuple x))))
      True)
Instance Writeable_Array'{!Empty_List[!Nat]}(
  Write_Brackets_Array' _ = Pair (List ("E", "m", "p", "t", "y", "_", "A", "r", "r", "a", "y", "'")) False)
Instance Writeable_Array'{!Construct_List[!Nat] N L}<Writeable_Array N, Writeable_Array' L>(
  Write_Brackets_Array' x =
    Pair
      (Cat
        (List ("C", "o", "n", "s", "t", "r", "u", "c", "t", "_", "A", "r", "r", "a", "y", "'", " "))
        (Brackets (Arrays x)))
      True)
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````