Dual

libretto.CoreLib.Dual
See theDual companion object
trait Dual[A, B]

Evidence that A flowing in one direction is equivalent to to B flowing in the opposite direction. It must hold that

       ┏━━━━━┓                         ┏━━━━━┓
       ┞─┐ r ┃                         ┃  l  ┞─┐
       ╎A│ I ┃                         ┃  I  ╎B│
       ┟─┘ n ┃                         ┃  n  ┟─┘
 ┏━━━━━┫   v ┃     ┏━━━━━━━━━┓         ┃  v  ┣━━━━━┓     ┏━━━━━━━━━┓
 ┃  l  ┞─┐ e ┃     ┞─┐       ┞─┐       ┃  e  ┞─┐ r ┃     ┞─┐       ┞─┐
 ┃  I  ╎B│ r ┃  =  ╎A│ id[A] ╎A│       ┃  r  ╎A│ I ┃  =  ╎B│ id[B] ╎B│
 ┃  n  ┟─┘ t ┃     ┟─┘       ┟─┘       ┃  t  ┟─┘ n ┃     ┟─┘       ┟─┘
 ┃  v  ┣━━━━━┛     ┗━━━━━━━━━┛         ┗━━━━━┫   v ┃     ┗━━━━━━━━━┛
 ┃  e  ┞─┐                                   ┞─┐ e ┃
 ┃  r  ╎A│                                   ╎B│ r ┃
 ┃  t  ┟─┘                                   ┟─┘ t ┃
 ┗━━━━━┛                                     ┗━━━━━┛

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def law_lr_id: Equal[B -⚬ B]

Law stating that lInvert followed by rInvert is identity.

Law stating that lInvert followed by rInvert is identity.

Attributes

def law_rl_id: Equal[A -⚬ A]

Law stating that rInvert followed by lInvert is identity.

Law stating that rInvert followed by lInvert is identity.

Attributes

Abstract fields

val lInvert: One -⚬ B |*| A

Reverses the output that flows against the -⚬ arrow (say it is the B output) to its dual (A) flowing in the direction of the arrow.

Reverses the output that flows against the -⚬ arrow (say it is the B output) to its dual (A) flowing in the direction of the arrow.

 ┏━━━━━┓
 ┃ l   ┞─┐
 ┃ I ┌─╎B│
 ┃ n ┆ ┟─┘
 ┃ v ┆ ┃
 ┃ e ┆ ┞─┐
 ┃ r └→╎A│
 ┃ t   ┟─┘
 ┗━━━━━┛

Attributes

val rInvert: A |*| B -⚬ One

Reverses the input that flows along the -⚬ arrow (say it is the A input) to its dual (B) flowing against the direction of the arrow.

Reverses the input that flows along the -⚬ arrow (say it is the A input) to its dual (B) flowing against the direction of the arrow.

 ┏━━━━━━━┓
 ┞─┐   r ┃
 ╎A│─┐ I ┃
 ┟─┘ ┆ n ┃
 ┃   ┆ v ┃
 ┞─┐ ┆ e ┃
 ╎B│←┘ r ┃
 ┟─┘   t ┃
 ┗━━━━━━━┛

Attributes