ComplexIntervalIntegerTest.java
package com.acme.math;

import church.lang.ByteStream;
import church.lang.operators.Arithmetic;
import church.lang.operators.Arithmetic.*;
import church.lang.operators.Relational.$$equal;
import church.lang.operators.Relational.$Max;
import church.lang.operators.Relational.$Min;
import church.lang.operators.Streams.$$encode;
import church.math.Complex;
import church.math.Interval;
import church.primitives.Integers;
import church.primitives.Objects;

import static church.lang.operators.Streams.output;
import static church.math.Complex.complex;
import static church.math.Interval.interval;

@SuppressWarnings("unchecked")
public class ComplexIntervalIntegerTest {
    private static final $$sum<Integer>                                                $S0  = Integers::$sum;
    private static final $$sum<Complex<Integer>>                                       $S1  = Complex.$sum($S0);
    private static final $Multiplicative_identity<Integer>                             $S2  = Integers::multiplicative_identity;
    private static final $Additive_identity<Integer>                                   $S3  = Integers::additive_identity;
    private static final $Multiplicative_identity<Complex<Integer>>                    $S4  = Complex.multiplicative_identity($S2, $S3);
    private static final $Successor<Complex<Integer>>                                  $S5  = ComplexIntervalIntegerTest.successor($S1, $S4);
    private static final $$encode<ByteStream, String>                                  $S6  = Objects::$encode;
    private static final $$encode<ByteStream, Integer>                                 $S7  = Integers::$encode;
    private static final $$encode<ByteStream, Complex<Integer>>                        $S8  = Complex.$encode($S6, $S7);
    private static final $$equal<Integer>                                              $S9  = Integers::$equal;
    private static final $$equal<Complex<Integer>>                                     $S10 = Complex.$equal($S9);
    private static final $$sum<Interval<Integer>>                                      $S11 = Interval.$sum($S0);
    private static final $$sum<Complex<Interval<Integer>>>                             $S12 = Complex.$sum($S11);
    private static final $Multiplicative_identity<Interval<Integer>>                   $S13 = Interval.multiplicative_identity($S2);
    private static final $Additive_identity<Interval<Integer>>                         $S14 = Interval.additive_identity($S3);
    private static final $Multiplicative_identity<Complex<Interval<Integer>>>          $S15 = Complex.multiplicative_identity($S13, $S14);
    private static final $Successor<Complex<Interval<Integer>>>                        $S16 = ComplexIntervalIntegerTest.successor($S12, $S15);
    private static final $$encode<ByteStream, Interval<Integer>>                       $S17 = Interval.$encode($S6, $S7);
    private static final $$encode<ByteStream, Complex<Interval<Integer>>>              $S18 = Complex.$encode($S6, $S17);
    private static final $$equal<Interval<Integer>>                                    $S19 = Interval.$equal($S9);
    private static final $$equal<Complex<Interval<Integer>>>                           $S20 = Complex.$equal($S19);
    private static final $$neg<Integer>                                                $S21 = Integers::$neg;
    private static final $$neg<Interval<Integer>>                                      $S22 = Interval.$neg($S21);
    private static final $$sub<Interval<Integer>>                                      $S23 = Arithmetic.$sub($S11, $S22);
    private static final $Min<Integer>                                                 $S24 = Integers::min;
    private static final $$prd<Integer, Integer>                                       $S25 = Integers::$prd;
    private static final $Max<Integer>                                                 $S26 = Integers::max;
    private static final $$prd<Interval<Integer>, Interval<Integer>>                   $S27 = Interval.$prd($S24, $S25, $S26);
    private static final $$prd<Complex<Interval<Integer>>, Complex<Interval<Integer>>> $S28 = Complex.$prd($S23, $S27, $S11);

    public static interface $Successor<T> {
        public T successor(T x);
    }

    public static <T> $Successor<T> successor($$sum<T> $L0, $Multiplicative_identity<T> $L1) {
        return x -> $L0.$sum(x, $L1.multiplicative_identity());
    }

    public static void main(String[] args) {
        Complex<Integer> c0 = complex(1, 2);
        Complex<Integer> c1 = $S5.successor(c0);
        $S6.$encode($S8.$encode(output, c1), "\n");
        assert $S10.$equal(c1, complex(2, 2));
        Complex<Interval<Integer>> ci0 = complex(interval(1, 2), interval(3, 4));
        Complex<Interval<Integer>> ci1 = $S16.successor(ci0);
        $S6.$encode($S18.$encode(output, ci1), "\n");
        assert $S20.$equal(ci1, complex(interval(2, 3), interval(3, 4)));
        Complex<Interval<Integer>> ci2 = $S28.$prd(ci0, ci0);
        $S6.$encode($S18.$encode(output, ci2), "\n");
        assert $S20.$equal(ci2, complex(interval(-15, -5), interval(6, 16)));
    }

}