Interface

Difficulty: hard — 7 definitions, 0 abbreviations, 0 lemmas, 6 theorems, 0 examples.

definition theorem
legend
NetworkLayer.Protocol : Type
Show details
| NetworkLayer.Protocol.data : NetworkLayer.Protocol
| NetworkLayer.Protocol.icmp : NetworkLayer.Protocol

Outer dependencies: (none)

Lean core dependencies: Eq, Nat, Nat.ble, PULift, cond, noConfusionEnum, noConfusionTypeEnum

instNonemptyProtocol : Nonempty NetworkLayer.Protocol
Show details
Nonempty.intro NetworkLayer.Protocol.data

Complexity: 5 (size of the value term)

Outer dependencies: NetworkLayer.Protocol

Lean core dependencies: Nonempty

instNormProtocol : Norm NetworkLayer.Protocol
Show details
{ norm := fun x => 1 }

Complexity: 17 (size of the value term)

Outer dependencies: NetworkLayer.Protocol

Mathlib dependencies: Norm, Real

Used by: instNormPacket

icmp
Icmp : Type
Show details
| Icmp.echoRequest : Icmp
| Icmp.echoReply : Icmp
| Icmp.destinationUnreachable : Icmp
| Icmp.timeExceeded : Icmp

Outer dependencies: (none)

Lean core dependencies: Eq, Nat, Nat.ble, PULift, cond, noConfusionEnum, noConfusionTypeEnum

instNonemptyIcmp : Nonempty Icmp
Show details
Nonempty.intro Icmp.echoRequest

Complexity: 5 (size of the value term)

Outer dependencies: Icmp

Lean core dependencies: Nonempty

instNormIcmp : Norm Icmp
Show details
{ norm := fun x => 1 }

Complexity: 17 (size of the value term)

Outer dependencies: Icmp

Mathlib dependencies: Norm, Real

Used by: instNormPacket

Packet (Address Payload : Type) : Type
Show details
| Packet.mk : {Address Payload : Type} 
  Address  Address  Address  NetworkLayer.Protocol  Icmp    Payload  Packet Address Payload

Outer dependencies: (none)

Inner dependencies: Icmp, NetworkLayer.Protocol

Lean core dependencies: Eq, HEq, Nat, SizeOf, eq_of_heq

instNonemptyPacket {Address Payload : Type} [Nonempty Address] [Nonempty Payload] :
  Nonempty (Packet Address Payload)
Show details
fun {Address Payload} [inst : Nonempty Address] [inst_1 : Nonempty Payload] =>
  Nonempty.intro
    { source := Classical.choice inst, dest := Classical.choice inst, next := Classical.choice inst,
      protocol := Classical.choice inferInstance, icmp := Classical.choice inferInstance, ttl := 0,
      payload := Classical.choice inst_1 }

Complexity: 83 (size of the value term)

Outer dependencies: Packet

Lean core dependencies: Nat, Nonempty, inferInstance

instNormPacket {Address Payload : Type} [Norm Address] [Norm Payload] :
  Norm (Packet Address Payload)
Show details
fun {Address Payload} [Norm Address] [Norm Payload] =>
  {
    norm := fun p =>
      p.source + p.dest + p.next + p.protocol + p.icmp + p.ttl + p.payload }

Complexity: 207 (size of the value term)

Outer dependencies: Packet

Mathlib dependencies: Norm, Real

Lean core dependencies: Nat.cast

network-layer
NetworkLayer.interface (Address : Type) [Nonempty Address] [Norm Address] (n : ) : InterfaceOld
Show details
fun Address [Nonempty Address] [Norm Address] n =>
  InterfaceOld.single (Packet Address (BitSequence n))

Complexity: 47 (size of the value term)

Outer dependencies: InterfaceOld

Mathlib dependencies: Norm

Lean core dependencies: Fin, Nat, Nonempty

DataLinkLayer.network (Address : Type) [Nonempty Address] [Norm Address] (poly : List Bool)
  (n : ) : Layer (DataLinkLayer.interface poly n) (NetworkLayer.interface Address n)
Show details
fun Address [Nonempty Address] [Norm Address] poly n v =>
  match v.left.observe, v.right.observe with
  | none, none => True
  | some e, some p => Frame.valid poly e  e.payload = p.payload
  | x, x_1 => False

Complexity: 269 (size of the value term)

Mathlib dependencies: Norm

ForwardingTable (Address : Type) : Type
Show details
| ForwardingTable.mk : {Address : Type}  (Address  Address  Option Address)  ForwardingTable Address

Outer dependencies: (none)

Lean core dependencies: Eq, HEq, Nat, Option, SizeOf, eq_of_heq

NetworkLayer.forwards (Address : Type) [Nonempty Address] [Norm Address]
  (table : ForwardingTable Address) (here : Address) (n : ) :
  Layer (NetworkLayer.interface Address n) (NetworkLayer.interface Address n)
Show details
fun Address [Nonempty Address] [Norm Address] table here n v =>
  match v.left.observe, v.right.observe with
  | none, none => True
  | some p, some q =>
    if p.ttl = 0 then
      q.source = here 
        q.dest = p.source  q.protocol = NetworkLayer.Protocol.icmp  q.icmp = Icmp.timeExceeded
    else
      match table.nextHop p.dest here with
      | some hop =>
        p.source = q.source 
          p.dest = q.dest 
            p.protocol = q.protocol  p.payload = q.payload  q.next = hop  q.ttl = p.ttl - 1
      | none =>
        q.source = here 
          q.dest = p.source 
            q.protocol = NetworkLayer.Protocol.icmp  q.icmp = Icmp.destinationUnreachable
  | x, x_1 => False

Complexity: 641 (size of the value term)

Mathlib dependencies: Norm

Lean core dependencies: And, Eq, False, Nat, Nat.hasNotBit, Nonempty, Option, True, Unit, Unit.unit, ite

Used by: (none)

Dependency diagram

Drag to pan, Ctrl+scroll (or Cmd+scroll, or pinch on a touch screen) to zoom, click a node to jump to it.

definitiontheoremdeclared elsewheredependencyproof dependency
legend