#import "../handout.typ": *
#import "../macros.typ": *

= Tropical Arithmetic

#definition()
The _tropical sum_ of two numbers is their minimum:
$
  x #tp y = min(x, y)
$

#definition()
The _tropical product_ of two numbers is their sum:
$
  x #tm y = x + y
$


#problem()
- Is tropical addition commutative? \
  #note([i.e, does $x #tp y = y #tp x$?])
- Is tropical addition associative? \
  #note([i.e, does $(x #tp y) #tp z = x #tp (y #tp z)$?])
- Is there a tropical additive identity? \
  #note([i.e, is there an $i$ so that $x #tp i = x$ for all real $x$?])

#solution([
  - Is tropical addition commutative?\
    Yes, $min(min(x,y),z) = min(x,y,z) = min(x,min(y,z))$
  - Is tropical addition associative? \
    Yes, $min(x,y) = min(y,x)$
  - Is there a tropical additive identity? \
    No. There is no $n$ where $x <= n$ for all real $x$
])

#v(1fr)

#problem()
Let's expand $#sym.RR$ to include a tropical additive identity.
- What would be an appropriate name for this new number?
- Give a reasonable definition for...
  - the tropical sum of this number and a real number $x$
  - the tropical sum of this number and itself
  - the tropical product of this number and a real number $x$
  - the tropical product of this number and itself

#solution([
  #sym.infinity makes sense, with
  $#sym.infinity #tp x = x$; #h(1em)
  $#sym.infinity #tp #sym.infinity = #sym.infinity$; #h(1em)
  $#sym.infinity #tm x = #sym.infinity$; #h(1em) and
  $#sym.infinity #tm #sym.infinity = #sym.infinity$
])

#v(1fr)
#pagebreak() // MARK: page





#problem()
Do tropical additive inverses exist? \
#note([Is there an inverse $y$ for every $x$ so that $x #tp y = #sym.infinity$?])

#solution([
  No. Unless $x = #sym.infinity$, there is no x where $min(x, y) = #sym.infinity$
])

#v(1fr)



#problem()
Is tropical multiplication associative? \
#note([Does $(x #tm y) #tm z = x #tm (y #tm z)$ for all $x,y,z$?])

#solution([Yes, since (normal) addition is associative])

#v(1fr)


#problem()
Is tropical multiplication commutative? \
#note([Does $x #tm y = y #tm x$ for all $x, y$?])

#solution([Yes, since (normal) addition is commutative])

#v(1fr)


#problem()
Is there a tropical multiplicative identity? \
#note([Is there an $i$ so that $x #tm i = x$ for all $x$?])

#solution([Yes, it is 0.])

#v(1fr)


#problem()
Do tropical multiplicative inverses always exist? \
#note([
  For every $x != #sym.infinity$, does there exist an inverse $y$ so that $x #tm y = i$, \
  where $i$ is the additive identity?
])

#solution([Yes, it is $-x$. For $x != 0$, $x #tm (-x) = 0$])

#v(1fr)
#pagebreak() // MARK: page


#problem()
Is tropical multiplication distributive over addition? \
#note([Does $x #tm (y #tp z) = x #tm y #tp x #tm z$?])

#solution([Yes, $x + min(y,z) = min(x+y, x+z)$])

#v(1fr)

#problem()
Fill the following tropical addition and multiplication tables

#let col = 10mm

#notsolution(
  table(
    columns: (1fr, 1fr),
    align: center,
    stroke: none,
    table(
      columns: (col, col, col, col, col, col),
      align: center,
      table.header(
        [$#tp$],
        [$1$],
        [$2$],
        [$3$],
        [$4$],
        [$#sym.infinity$],
      ),

      box(inset: 3pt, $1$), [], [], [], [], [],
      box(inset: 3pt, $2$), [], [], [], [], [],
      box(inset: 3pt, $3$), [], [], [], [], [],
      box(inset: 3pt, $4$), [], [], [], [], [],
      box(inset: 3pt, $#sym.infinity$), [], [], [], [], [],
    ),
    table(
      columns: (col, col, col, col, col, col),
      align: center,
      table.header(
        [$#tm$],
        [$0$],
        [$1$],
        [$2$],
        [$3$],
        [$4$],
      ),

      box(inset: 3pt, $0$), [], [], [], [], [],
      box(inset: 3pt, $1$), [], [], [], [], [],
      box(inset: 3pt, $2$), [], [], [], [], [],
      box(inset: 3pt, $3$), [], [], [], [], [],
      box(inset: 3pt, $4$), [], [], [], [], [],
    ),
  ),
)

#solution(
  table(
    columns: (1fr, 1fr),
    align: center,
    stroke: none,
    table(
      columns: (col, col, col, col, col, col),
      align: center,
      table.header(
        [$#tp$],
        [$1$],
        [$2$],
        [$3$],
        [$4$],
        [$#sym.infinity$],
      ),

      box(inset: 3pt, $1$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $1$),

      box(inset: 3pt, $2$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $2$),
      box(inset: 3pt, $2$),
      box(inset: 3pt, $2$),
      box(inset: 3pt, $2$),

      box(inset: 3pt, $3$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $2$),
      box(inset: 3pt, $3$),
      box(inset: 3pt, $3$),
      box(inset: 3pt, $3$),

      box(inset: 3pt, $4$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $2$),
      box(inset: 3pt, $3$),
      box(inset: 3pt, $4$),
      box(inset: 3pt, $4$),

      box(inset: 3pt, $#sym.infinity$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $2$),
      box(inset: 3pt, $3$),
      box(inset: 3pt, $4$),
      box(inset: 3pt, $#sym.infinity$),
    ),
    table(
      columns: (col, col, col, col, col, col),
      align: center,
      table.header(
        [$#tm$],
        [$0$],
        [$1$],
        [$2$],
        [$3$],
        [$4$],
      ),

      box(inset: 3pt, $0$),
      box(inset: 3pt, $0$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $2$),
      box(inset: 3pt, $3$),
      box(inset: 3pt, $4$),

      box(inset: 3pt, $1$),
      box(inset: 3pt, $1$),
      box(inset: 3pt, $2$),
      box(inset: 3pt, $3$),
      box(inset: 3pt, $4$),
      box(inset: 3pt, $5$),

      box(inset: 3pt, $2$),
      box(inset: 3pt, $2$),
      box(inset: 3pt, $3$),
      box(inset: 3pt, $4$),
      box(inset: 3pt, $5$),
      box(inset: 3pt, $6$),

      box(inset: 3pt, $3$),
      box(inset: 3pt, $3$),
      box(inset: 3pt, $4$),
      box(inset: 3pt, $5$),
      box(inset: 3pt, $6$),
      box(inset: 3pt, $7$),

      box(inset: 3pt, $4$),
      box(inset: 3pt, $4$),
      box(inset: 3pt, $5$),
      box(inset: 3pt, $6$),
      box(inset: 3pt, $7$),
      box(inset: 3pt, $8$),
    ),
  ),
)


#v(2mm)

#problem()
Expand and simplify $f(x) = (x #tp 2)(x #tp 3)$, then evaluate $f(1)$ and $f(4)$ \
#hint([Adjacent parenthesis imply tropical multiplication])

#solution([
  $
    (x #tp 2)(x #tp 3)
    &= x^2 #tp 2x #tp 3x #tp (2 #tm 3) \
    &= x^2 #tp (2 #tp 3)x #tp (2 #tm 3) \
    &= x^2 #tp 2x #tp 5
  $

  Also, $f(1) = 2$ and $f(4) = 5$.
])

#v(1fr)