Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/paulch42/lean-spec/llms.txt

Use this file to discover all available pages before exploring further.

LeanSpec.FPL.Core defines the fundamental data elements from which all higher-level FPL entities are built. These definitions are of a general nature and are applicable beyond the narrow focus of flight plan processing — they model ICAO-standard identifiers, designators, equipment codes, speed and distance measures, position representations, and communication infrastructure. Understanding this module provides the vocabulary for every other module in the FPL specification; it is sufficient to skim it to grasp the remainder of the specification. The module imports LeanSpec.lib.Util (for bounded string and natural number types) and LeanSpec.lib.Geo (for geographic primitives), then opens the Core namespace.
import LeanSpec.lib.Util
import LeanSpec.lib.Geo

namespace Core

General Purpose

FreeText

A number of message fields carry free text. While ICAO restricts the character set to a subset of ASCII, the specification elides that constraint and allows any string of length 1–200 characters.
def maxTextLength := 200

def FreeText := Str 1 maxTextLength
deriving DecidableEq

These definitions relate to the flight that is the subject of a message. The key distinction throughout the specification is between a flight (the operation from departure to destination) and an aircraft (the physical airframe).

AircraftIdentification

The call-sign or registration mark used by air traffic control to identify the flight in communications. Length is constrained to 2–7 characters.
def AircraftIdentification := Str 2 7
deriving DecidableEq

SsrCode

The Secondary Surveillance Radar code — exactly four octal characters — transmitted by the aircraft’s transponder and used by ATC to track the flight. It is typically allocated by ATC shortly before take-off.
def SsrCode := Str 4 4
deriving DecidableEq

FlightRule

A single flight rule applicable at a specific point in a flight’s route. Depending on equipment held, a flight may operate under instrument or visual flight rules.
inductive FlightRule
  | ifr  -- instrument flight rules
  | vfr  -- visual flight rules
deriving DecidableEq

FlightRules

The operating rules for the entire duration of a flight. Rules may remain constant (IFR or VFR) or change mid-flight, in which case the initial rule and the direction of change are encoded.
inductive FlightRules
  | i  -- IFR throughout
  | v  -- VFR throughout
  | y  -- IFR first, then changing to VFR
  | z  -- VFR first, then changing to IFR
deriving DecidableEq

TypeOfFlight

Flights are categorised to assist ATC with handling priorities and procedures.
inductive TypeOfFlight
  | s  -- Scheduled flight
  | n  -- Non-scheduled flight
  | g  -- General Aviation (GA)
  | m  -- Military
  | x  -- Other
deriving DecidableEq

SpecialHandling

Some flights receive non-standard ATC handling due to their nature — for example, medical evacuations, head-of-state flights, and search-and-rescue operations.
inductive SpecialHandling
  | altrv
  | atfmx
  | ffr
  | fltck
  | hazmat
  | head
  | hosp
  | hum
  | marsa
  | medevac
  | nonrvsm
  | sar
  | state
deriving DecidableEq

Registration

The physical aircraft registration mark allocated by the authorising national authority. It appears as tail markings. For general aviation, the aircraft identification is often the registration. Length is constrained to 2–7 characters.
def Registration := Str 2 7
deriving DecidableEq

NumberOfAircraft

The number of aircraft participating in a formation flight. Constrained to 2–99.
def NumberOfAircraft := NatMN 2 99
deriving DecidableEq

Doc8643.Designator

The ICAO aircraft type designator as documented in ICAO Doc 8643. For example, A388 denotes the Airbus A380-800. Length is 2–4 characters.
def Doc8643.Designator := Str 2 4
deriving DecidableEq

AircraftType

Not all aircraft types have a Doc 8643 designator. AircraftType is a sum type: either a documented designator or a free-text name.
inductive AircraftType
  | desig (_ : Doc8643.Designator)
  | name (_ : FreeText)
deriving DecidableEq

AircraftAddress

The unique 24-bit ICAO address of the airframe, encoded as exactly six hexadecimal characters. This is distinct from the flight identifier.
def AircraftAddress := Str 6 6
deriving DecidableEq

AircraftPerformance

An ICAO performance category that summarises speed and climb characteristics. Used in some ATC procedures.
inductive AircraftPerformance
  | a | b | c | d | e | h
deriving DecidableEq

WakeTurbulenceCategory

Describes the severity of wing-tip vortices generated by the aircraft. ATC uses this to apply separation minima between successive aircraft.
inductive WakeTurbulenceCategory
  | h  -- high
  | m  -- medium
  | l  -- low
deriving DecidableEq

Distance: Horizontal and Vertical

UnitOfVerticalDistance

Vertical distance in aviation may be expressed in either feet (imperial) or metres (metric).
inductive UnitOfVerticalDistance
  | feet
  | metres
deriving DecidableEq

FlightLevelOrAltitude

Vertical position is expressed as a flight level (above the transition level, referenced to standard pressure) or an altitude (below the transition level, referenced to local QNH pressure).
inductive FlightLevelOrAltitude
  | flightLevel
  | altitude
deriving DecidableEq

VerticalPositionOfAircraft

A full expression of the vertical position of an aircraft, combining a numeric value with its unit of measure and the type (flight level or altitude).
structure VerticalPositionOfAircraft where
  value : Int
  uom   : UnitOfVerticalDistance
  type  : FlightLevelOrAltitude
deriving DecidableEq

UnitOfHorizontalDistance

For the purposes of this specification, only nautical miles are required for horizontal distance.
inductive UnitOfHorizontalDistance
  | nm
deriving DecidableEq

HorizontalDistance

A horizontal distance expressed as a natural number of nautical miles.
structure HorizontalDistance where
  value : Nat
  uom   : UnitOfHorizontalDistance
deriving DecidableEq

Speed

UnitOfSpeed

Aircraft speed may be expressed in knots, kilometres per hour, or as a Mach number (fraction of the speed of sound).
inductive UnitOfSpeed
  | kt
  | kph
  | mach
deriving DecidableEq

SpeedDatum

The reference frame against which speed is measured:
  • tas — true airspeed: speed through the air mass.
  • ias — indicated airspeed: instrument-panel reading.
  • gspd — groundspeed: speed relative to the ground.
inductive SpeedDatum
  | tas
  | ias
  | gspd
deriving DecidableEq

AircraftSpeed

A complete aircraft speed value combining a numeric magnitude, a unit of measure, and a datum. The structure carries a proof of the invariant that groundspeed cannot be expressed as a Mach number (which is defined relative to the air mass, not the ground).
structure AircraftSpeed where
  value : Nat
  uom   : UnitOfSpeed
  datum : SpeedDatum
  inv   : -- Ground speed cannot be expressed as a mach number
          datum = .gspd → uom ≠ .mach
deriving DecidableEq

TrueAirspeed

A subtype of AircraftSpeed restricted to entries where the datum is tas. This is the speed measure used in route planning fields.
def TrueAirspeed := { spd : AircraftSpeed // spd.datum = .tas }
deriving DecidableEq

Doc7910.Designator

The four-character ICAO location indicator for aerodromes and other landing sites, as documented in ICAO Doc 7910. For example, EHAM for Amsterdam Schiphol.
def Doc7910.Designator := Str 4 4
deriving DecidableEq

Waypoint

A named geographic point used for defining the horizontal path (route) of a flight. Length is 2–5 characters.
def Waypoint := Str 2 5
deriving DecidableEq

RelativePoint

A position expressed as a bearing and distance from a known named waypoint.
structure RelativePoint where
  point    : Waypoint
  bearing  : Geo.Direction
  distance : HorizontalDistance
deriving DecidableEq

Position

A position can be represented in three ways: as a geographic coordinate (latitude/longitude), as a named waypoint, or as a relative point.
inductive Position
  | geo (_ : Geo.Point)
  | wpt (_ : Waypoint)
  | rel (_ : RelativePoint)
deriving DecidableEq

Position.waypointOf

Extracts the named waypoint from a Position, if the position is expressed as a waypoint. Returns none for geographic or relative positions.
def Position.waypointOf : Position → Option Waypoint
  | .wpt pt => pt
  | _       => none

NameAndPosition

Used when an aircraft departs or arrives at a site that has no ICAO designator. Provides a descriptive name and a geographic position.
structure NameAndPosition where
  name     : FreeText
  position : Position
deriving DecidableEq

LandingSite

A landing site is identified either by its ICAO Doc 7910 designator or by a name and position (when no designator exists).
inductive LandingSite
  | desig (_ : Doc7910.Designator)
  | namePos (_ : NameAndPosition)
deriving DecidableEq

Doc7910.FIRDesignator

The four-character designator for a Flight Information Region (FIR) — the division of airspace managed by a specific ATC authority. Also documented in ICAO Doc 7910.
def Doc7910.FIRDesignator := Str 4 4
deriving DecidableEq

Equipment and Capabilities

Communication, navigation, and surveillance equipment and their capabilities are identified by standardised codes defined in ICAO PANS-ATM.

CommNavAppCode

Communication, navigation, and approach aid equipment codes. The full set of PANS-ATM codes is enumerated as constructors.
inductive CommNavAppCode
  | s  | a  | b  | c  | d
  | e1 | e2 | e3
  | f  | g  | h  | i
  | j1 | j2 | j3 | j4 | j5 | j6 | j7
  | k  | l
  | m1 | m2 | m3
  | o
  | p1 | p2 | p3 | p4 | p5 | p6 | p7 | p8 | p9
  | r  | t  | u  | v  | w  | x  | y  | z
deriving DecidableEq

SurveillanceCode

Surveillance equipment and capability codes, covering SSR modes A/C/S, ADS-B/C variants, and TCAS-related codes.
inductive SurveillanceCode
  | a  | c  | e  | h  | i  | l  | p  | s  | x
  | b1 | b2
  | u1 | u2
  | v1 | v2
  | d1 | g1
deriving DecidableEq

PBNCode

Performance Based Navigation (PBN) codes, specifying the navigation specifications that the aircraft is capable of meeting. Up to 8 codes may appear in a flight plan.
inductive PBNCode
  | a1
  | b1 | b2 | b3 | b4 | b5 | b6
  | c1 | c2 | c3 | c4
  | d1 | d2 | d3 | d4
  | l1
  | o1 | o2 | o3 | o4
  | s1 | s2
  | t1 | t2
deriving DecidableEq

SelcalCode

The Selective Calling (SELCAL) code — exactly four characters — used to alert a specific aircraft over HF radio without requiring the crew to continuously monitor the frequency.
def SelcalCode := Str 4 4
deriving DecidableEq

RouteDesignator

The designator of a published ATS route — a fixed 3D corridor in airspace that aircraft may follow. Length is 2–7 characters.
def RouteDesignator := Str 2 7
deriving DecidableEq

Stakeholder Communication

ATSUnit

The four-character designator for an Air Traffic Services authority. Used, for example, to identify the ATS unit responsible for a flight filed in the air (AFIL).
def ATSUnit := Str 4 4
deriving DecidableEq

AFTNAddress

An eight-character address on the global Aeronautical Fixed Telecommunications Network (AFTN), used for routing ATS messages between providers.
def AFTNAddress := Str 8 8
deriving DecidableEq

end Core

Build docs developers (and LLMs) love