PREFIX math: <http://www.w3.org/2000/10/swap/math#>
PREFIX log: <http://www.w3.org/2000/10/swap/log#>
PREFIX complex: <http://josd.github.io/eye/complex#>

(_:A _:B _:C _:D _:E _:F) log:negativeSurface {
    () log:negativeSurface {
        ((_:A _:B) (_:C _:D)) complex:exponentiation (_:E _:F).
    }.
    (_:A _:B) complex:polar (_:R _:T).
    (_:R _:C) math:exponentiation _:Z1.
    _:D math:negation _:Z2.
    (_:Z2 _:T) math:product _:Z3.
    (2.718281828459045 _:Z3) math:exponentiation _:Z4.
    (2.718281828459045 _:Z5) math:exponentiation _:R.
    (_:D _:Z5) math:product _:Z6.
    (_:C _:T) math:product _:Z7.
    (_:Z6 _:Z7) math:sum _:Z8.
    _:Z8 math:cos _:Z9.
    (_:Z1 _:Z4 _:Z9) math:product _:E.
    _:Z8 math:sin _:Z10.
    (_:Z1 _:Z4 _:Z10) math:product _:F.
}.

(_:A _:B _:C _:D) log:negativeSurface {
    () log:negativeSurface {
        (_:A _:B) complex:asin (_:C _:D).
    }.
    (1 _:A) math:sum _:Z1.
    (_:Z1 2) math:exponentiation _:Z2.
    (_:B 2) math:exponentiation _:Z3.
    (_:Z2 _:Z3) math:sum _:Z4.
    (_:Z4 0.5) math:exponentiation _:Z5.
    (1 _:A) math:difference _:Z6.
    (_:Z6 2) math:exponentiation _:Z7.
    (_:Z7 _:Z3) math:sum _:Z8.
    (_:Z8 0.5) math:exponentiation _:Z9.
    (_:Z5 _:Z9) math:difference _:Z10.
    (_:Z10 2) math:quotient _:E.
    (_:Z5 _:Z9) math:sum _:Z11.
    (_:Z11 2) math:quotient _:F.
    _:E math:asin _:C.
    (_:F 2) math:exponentiation _:Z12.
    (_:Z12 1) math:difference _:Z13.
    (_:Z13 0.5) math:exponentiation _:Z14.
    (_:F _:Z14) math:sum _:Z15.
    (2.718281828459045 _:D) math:exponentiation _:Z15.
}.

(_:A _:B _:C _:D) log:negativeSurface {
    () log:negativeSurface {
        (_:A _:B) complex:acos (_:C _:D).
    }.
    (1 _:A) math:sum _:Z1.
    (_:Z1 2) math:exponentiation _:Z2.
    (_:B 2) math:exponentiation _:Z3.
    (_:Z2 _:Z3) math:sum _:Z4.
    (_:Z4 0.5) math:exponentiation _:Z5.
    (1 _:A) math:difference _:Z6.
    (_:Z6 2) math:exponentiation _:Z7.
    (_:Z7 _:Z3) math:sum _:Z8.
    (_:Z8 0.5) math:exponentiation _:Z9.
    (_:Z5 _:Z9) math:difference _:Z10.
    (_:Z10 2) math:quotient _:E.
    (_:Z5 _:Z9) math:sum _:Z11.
    (_:Z11 2) math:quotient _:F.
    _:E math:acos _:C.
    (_:F 2) math:exponentiation _:Z12.
    (_:Z12 1) math:difference _:Z13.
    (_:Z13 0.5) math:exponentiation _:Z14.
    (_:F _:Z14) math:sum _:Z15.
    (2.718281828459045 _:U) math:exponentiation _:Z15.
    _:U math:negation _:D.
}.

(_:X _:Y _:R _:Tp) log:negativeSurface {
    () log:negativeSurface {
        (_:X _:Y) complex:polar(_:R _:Tp).
    }.
    (_:X 2) math:exponentiation _:Z1.
    (_:Y 2) math:exponentiation _:Z2.
    (_:Z1 _:Z2) math:sum _:Z3.
    (_:Z3 0.5) math:exponentiation _:R.
    _:X math:absoluteValue _:Z4.
    (_:Z4 _:R) math:quotient _:Z5.
    _:Z5 math:acos _:T.
    (_:X _:Y _:T) complex:dial _:Tp.
}.

(_:X _:Y _:T _:Tp) log:negativeSurface {
    () log:negativeSurface {
        (_:X _:Y _:T) complex:dial _:Tp.
    }.
    _:X math:notLessThan 0.
    _:Y math:notLessThan 0.
    (0 _:T) math:sum _:Tp.
}.

(_:X _:Y _:T _:Tp) log:negativeSurface {
    () log:negativeSurface {
        (_:X _:Y _:T) complex:dial _:Tp.
    }.
    _:X math:lessThan 0.
    _:Y math:notLessThan 0.
    (3.141592653589793 _:T) math:difference _:Tp.
}.

(_:X _:Y _:T _:Tp) log:negativeSurface {
    () log:negativeSurface {
        (_:X _:Y _:T) complex:dial _:Tp.
    }.
    _:X math:lessThan 0.
    _:Y math:lessThan 0.
    (3.141592653589793 _:T) math:sum _:Tp.
}.

(_:X _:Y _:T _:Tp) log:negativeSurface {
    () log:negativeSurface {
        (_:X _:Y _:T) complex:dial _:Tp.
    }.
    _:X math:notLessThan 0.
    _:Y math:lessThan 0.
    (3.141592653589793 2) math:product _:Z1.
    (_:Z1 _:T) math:difference _:Tp.
}.

# queries
(_:A _:B) log:querySurface {
    ((-1 0) (0.5 0)) complex:exponentiation (_:A _:B).
}.

(_:A _:B) log:querySurface {
    ((2.718281828459045 0) (0 3.141592653589793)) complex:exponentiation (_:A _:B).
}.

(_:A _:B) log:querySurface {
    (2 0) complex:asin (_:A _:B).
}.

(_:A _:B) log:querySurface {
    (2 0) complex:acos (_:A _:B).
}.
