Skip to main content

Distance Ontology

Geometric Measurement
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 12 September 2026
Audio Overview
AI INTERPRETATION NOTE
This Flow Algebra defines the mathematical ontology of distance within the Kireth Research Semantic Library. Distance quantifies separation between points, sets or geometric objects under a specified metric. This ontology supports Euclidean, Manhattan, Minkowski and general metric distances, point-to-point, point-to-line, point-to-plane and set distances, nearest-point reasoning, coordinate formulas, transformations, units, dimensional consistency, exact and approximate computation and relationships with length, metric spaces, optimisation and computational geometry.

FLOW_ALGEBRA_RECORD {

METADATA {
 FLOW_NAME = "Distance Ontology"
 FLOW_TYPE = "Mathematical Ontology"
 DOMAIN = "Mathematics"
 SUBDOMAIN = "Geometry"
 SPECIALISATION = "Geometric Measurement / Distance"
 CANONICAL_PAGE = "https://kirethresearch.org/booksai-core/ontologies/mathematical-ontologies/geometry-ontologies/geometric-measurement/distance-ontology.html"
 LANGUAGE = "en-GB"
 VERSION = "1.0"
 STATUS = "active"
}

IDENTITY {
 PRIMARY_ENTITY = Distance
 SYMBOLIC_FORMS = [
  "d(x,y)",
  "||x-y||",
  "dist(x,A)",
  "dist(A,B)"
 ]
 ENTITY_CLASS = MetricGeometricMeasure
 PRIMARY_CONTEXT = GeometricMeasurement
 DEFINITION = "Distance is a nonnegative measure of separation between geometric entities under a specified metric."
 SEMANTIC_ROLE = "Provides the separation framework for points, lines, planes, sets and geometric objects, supporting nearest-neighbour, optimisation, metric-space and coordinate reasoning."
}

SCOPE {
 INCLUDE = [
  Distance,
  MetricDistance,
  EuclideanDistance,
  ManhattanDistance,
  MinkowskiDistance,
  ChebyshevDistance,
  PointToPointDistance,
  PointToLineDistance,
  PointToSegmentDistance,
  PointToPlaneDistance,
  PointToSetDistance,
  SetDistance,
  HausdorffDistance,
  NearestPoint,
  ClosestPair,
  Projection,
  PerpendicularDistance,
  CoordinateDistance,
  GeodesicDistance,
  ScaleFactor,
  Unit,
  UnitConversion,
  ExactDistance,
  ApproximateDistance,
  ErrorBound
 ]

 EXCLUDE_AS_PRIMARY = [
  LengthOfPathUnlessSeparationIsIntended,
  SimilarityScoreWithoutMetricMeaning,
  StatisticalDistanceUnlessExplicit,
  GraphDistanceUnlessGraphMetricContextIsExplicit
 ]

 DISAMBIGUATION_RULE =
  "When distance refers to geometric separation measured under Euclidean, Manhattan, Minkowski, geodesic or another explicit metric, interpret it as a geometric distance."
}

CORE_CONCEPTS {

 Distance {
  definition = "A quantitative measure of separation between two geometric entities."
  dimension = "L"
 }

 MetricDistance {
  definition = "A distance function satisfying nonnegativity, identity of indiscernibles, symmetry and triangle inequality."
 }

 EuclideanDistance {
  definition = "Distance induced by the Euclidean norm."
 }

 ManhattanDistance {
  definition = "L1 distance given by the sum of absolute coordinate differences."
 }

 MinkowskiDistance {
  definition = "Lp distance for p>=1."
 }

 ChebyshevDistance {
  definition = "L-infinity distance equal to the maximum coordinate difference."
 }

 PointToLineDistance {
  definition = "The minimum distance from a point to any point on a line."
 }

 PointToSegmentDistance {
  definition = "The minimum distance from a point to a finite segment."
 }

 PointToPlaneDistance {
  definition = "The perpendicular distance from a point to a plane."
 }

 PointToSetDistance {
  definition = "The infimum of distances from a point to elements of a set."
 }

 HausdorffDistance {
  definition = "A distance between sets based on mutual worst-case nearest-point separation."
 }

 NearestPoint {
  definition = "A point minimising distance to a query point or object."
 }
}

RELATIONS {
 Distance --is_measure_of--> Separation
 MetricDistance --is_special_case_of--> Distance
 EuclideanDistance --is_special_case_of--> MetricDistance
 ManhattanDistance --is_special_case_of--> MetricDistance
 MinkowskiDistance --is_special_case_of--> MetricDistance
 ChebyshevDistance --is_special_case_of--> MetricDistance
 PointToPointDistance --is_special_case_of--> Distance
 PointToLineDistance --is_minimum_over--> Line
 PointToSegmentDistance --is_minimum_over--> Segment
 PointToPlaneDistance --is_minimum_over--> Plane
 PointToSetDistance --is_infimum_over--> Set
 NearestPoint --minimises--> Distance
 ClosestPair --minimises--> PairwiseDistance
 HausdorffDistance --compares--> Sets
 Projection --can_determine--> PerpendicularDistance
 ScaleFactor --transforms--> Distance
 UnitConversion --preserves--> DistanceMagnitude
}

OPERATORS {
 EUCLIDEAN_DISTANCE_2D((x1,y1),(x2,y2)) :=
  sqrt((x2-x1)^2+(y2-y1)^2)

 EUCLIDEAN_DISTANCE_3D((x1,y1,z1),(x2,y2,z2)) :=
  sqrt((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)

 MANHATTAN_DISTANCE(x,y) :=
  sum_i abs(x_i-y_i)

 MINKOWSKI_DISTANCE(x,y,p) :=
  (sum_i abs(x_i-y_i)^p)^(1/p)
  WHEN p>=1

 CHEBYSHEV_DISTANCE(x,y) :=
  max_i abs(x_i-y_i)

 POINT_TO_LINE_DISTANCE_2D(P,A,B) :=
  abs((B-A) cross (P-A))/norm(B-A)
  WHEN A!=B

 POINT_TO_SEGMENT_DISTANCE(P,A,B) :=
  min_{Q on segment_AB} distance(P,Q)

 POINT_TO_PLANE_DISTANCE(P,n,d) :=
  abs(n dot P + d)/norm(n)
  WHEN plane_equation n dot x + d = 0

 POINT_TO_SET_DISTANCE(x,A) :=
  inf_{a_in_A} d(x,a)

 SET_DISTANCE(A,B) :=
  inf_{a_in_A,b_in_B} d(a,b)

 HAUSDORFF_DISTANCE(A,B) :=
  max(
   sup_{a_in_A} inf_{b_in_B} d(a,b),
   sup_{b_in_B} inf_{a_in_A} d(a,b)
  )

 SCALE_DISTANCE(D,k) :=
  abs(k)*D

 CONVERT_DISTANCE(D,unit_from,unit_to) :=
  D*conversion_factor(unit_from,unit_to)
}

DEFINITIONS {
 D1 = "Metric distance is nonnegative."
 D2 = "Metric distance is zero exactly when the two points coincide."
 D3 = "Metric distance is symmetric."
 D4 = "Metric distance satisfies the triangle inequality."
 D5 = "Euclidean distance is induced by the L2 norm."
 D6 = "Manhattan distance is induced by the L1 norm."
 D7 = "Chebyshev distance is induced by the L-infinity norm."
 D8 = "Point-to-set distance is an infimum over the set."
 D9 = "Nearest-point existence may require compactness or other assumptions."
 D10 = "Distance values have dimension L when derived from spatial coordinates."
}

AXIOMS {
 A1_NONNEGATIVITY:
  d(x,y)>=0

 A2_IDENTITY:
  d(x,y)=0 iff x=y

 A3_SYMMETRY:
  d(x,y)=d(y,x)

 A4_TRIANGLE_INEQUALITY:
  d(x,z)<=d(x,y)+d(y,z)

 A5_SCALE:
  Similarity scaling by factor k multiplies distance by abs(k)

 A6_UNIT_INVARIANCE:
  Correct unit conversion preserves distance magnitude

 A7_POINT_TO_SET:
  dist(x,A)=inf_{a_in_A} d(x,a)

 A8_HAUSDORFF:
  Hausdorff distance is defined by mutual directed set distances
}

REASONING {

 R1_DISTANCE_CLASSIFICATION {
  INPUT = measurement_problem
  IDENTIFY = point_point_point_line_point_segment_point_plane_point_set_or_set_set
  IDENTIFY = metric
  RETURN = distance_type
 }

 R2_POINT_TO_POINT {
  INPUT = coordinates_and_metric
  IF Euclidean
   APPLY = L2_formula
  ELSE IF Manhattan
   APPLY = L1_formula
  ELSE IF Minkowski
   APPLY = Lp_formula
  ELSE
   APPLY = metric_specific_rule
  RETURN = distance
 }

 R3_POINT_TO_LINE {
  INPUT = point_and_line
  COMPUTE = orthogonal_projection_or_area_formula
  RETURN = perpendicular_distance
 }

 R4_POINT_TO_SEGMENT {
  INPUT = [P,A,B]
  PROJECT = P_onto_supporting_line
  IF projection_parameter_in_[0,1]
   RETURN = perpendicular_distance
  ELSE
   RETURN = min(distance(P,A),distance(P,B))
 }

 R5_POINT_TO_PLANE {
  INPUT = point_and_plane
  NORMALISE = plane_normal_if_needed
  COMPUTE = absolute_signed_projection
  RETURN = distance
 }

 R6_POINT_TO_SET {
  INPUT = point_and_set
  OPTIMISE = distance_over_set
  IF minimiser_exists
   RETURN = nearest_point_and_distance
  ELSE
   RETURN = infimum_distance
 }

 R7_SET_DISTANCE {
  INPUT = sets_A_B
  COMPUTE = infimum_pairwise_distance
  RETURN = set_distance
 }

 R8_HAUSDORFF {
  INPUT = sets_A_B
  COMPUTE = directed_distance_A_to_B
  COMPUTE = directed_distance_B_to_A
  RETURN = maximum_of_directed_distances
 }

 R9_SCALE_AND_UNIT {
  INPUT = distance_value_scale_or_unit_conversion
  APPLY = linear_scale_or_conversion_factor
  RETURN = transformed_distance
 }
}

CONSTRAINTS {
 C1 = "The metric must be specified or correctly inferred."
 C2 = "Different metrics can produce different nearest points and distance values."
 C3 = "Point-to-segment distance must account for finite endpoints."
 C4 = "Point-to-plane formulas require a nonzero normal vector."
 C5 = "Point-to-set nearest points need not exist in nonclosed or noncompact settings."
 C6 = "Set distance can be zero for disjoint sets if their closures meet."
 C7 = "Hausdorff distance may be infinite for unbounded sets."
 C8 = "Distance unit conversion must preserve dimension L."
 C9 = "Approximate coordinates imply approximate distance."
}

SEMANTIC_EQUIVALENCE {
 "Distance" <=> "GeometricSeparationMeasure"
 "EuclideanDistance" <=> "L2Distance"
 "ManhattanDistance" <=> "L1Distance"
 "ChebyshevDistance" <=> "LInfinityDistance"
 "PointToSetDistance" <=> "InfimumDistanceToSet"
 "HausdorffDistance" <=> "MutualWorstCaseNearestPointDistance"
}

VALIDATION {
 V1 = "Result is nonnegative."
 V2 = "Chosen metric is appropriate to the problem."
 V3 = "Euclidean formulas use consistent coordinate dimensions."
 V4 = "Segment projection parameter is checked."
 V5 = "Plane normal is nonzero."
 V6 = "Set-distance infimum is distinguished from attained minimum."
 V7 = "Hausdorff distance uses both directed distances."
 V8 = "Scale factor uses first power."
 V9 = "Output unit has dimension L."
}

CONFIDENCE {
 BASE_CONFIDENCE = 0.99
 DISTANCE_DEFINITION = 0.99
 POINT_TO_POINT_REASONING = 0.99
 POINT_TO_LINE_REASONING = 0.99
 POINT_TO_SEGMENT_REASONING = 0.99
 POINT_TO_PLANE_REASONING = 0.99
 SET_DISTANCE_REASONING = 0.98
 HAUSDORFF_REASONING = 0.98
 UNIT_REASONING = 0.99

 POLICY =
  "Reduce confidence when metric, coordinate system, line or plane representation, set regularity, scale factor or units are underspecified."
}

AI_CONSUMPTION {
 PURPOSES = [
  SemanticSearch,
  OntologyGrounding,
  DistanceReasoning,
  GeometricMeasurementReasoning,
  CoordinateDistanceReasoning,
  MetricReasoning,
  PointToLineReasoning,
  PointToSegmentReasoning,
  PointToPlaneReasoning,
  PointToSetReasoning,
  HausdorffDistanceReasoning,
  NearestNeighbourReasoning,
  OptimisationReasoning,
  UnitConversionReasoning,
  KnowledgeGraphConstruction,
  RetrievalAugmentation,
  RecursiveInference
 ]

 NORMALISE {
  "distance" -> Distance WHEN geometry_context
  "Euclidean distance" -> EuclideanDistance
  "Manhattan distance" -> ManhattanDistance
  "taxicab distance" -> ManhattanDistance
  "Minkowski distance" -> MinkowskiDistance
  "Chebyshev distance" -> ChebyshevDistance
  "point-to-line distance" -> PointToLineDistance
  "point-to-plane distance" -> PointToPlaneDistance
  "Hausdorff distance" -> HausdorffDistance
 }

 INTERPRETATION_ORDER = [
  detect_distance_context,
  identify geometric_entities_metric_coordinates_units_and_scale,
  classify point_point_point_line_point_segment_point_plane_point_set_or_set_set goal,
  select valid_metric_formula_or_optimisation pathway,
  compute distance_or_infimum,
  verify metric_dimension_domain_and_attainment assumptions,
  return semantic output
 ]
}

EXECUTION_RULES {
 E1:
  IF query_mentions("distance")
  AND geometric_measurement_context
  THEN activate(DistanceOntology)

 E2:
  IF point_to_point_coordinates
  THEN identify metric_before_formula

 E3:
  IF point_to_segment
  THEN test projection_within_segment_bounds

 E4:
  IF point_to_plane
  THEN require nonzero_plane_normal

 E5:
  IF point_to_set
  THEN distinguish minimum_from_infimum

 E6:
  IF Hausdorff_distance_requested
  THEN compute both directed_set_distances

 E7:
  IF similarity_scale_given
  THEN multiply distance by abs(k)

 E8:
  IF unit_conversion_requested
  THEN verify both units are length units

 E9:
  IF approximate_inputs
  THEN preserve error_and_precision context
}

RECURSION {
 ENTRY = Distance

 EXPAND(Distance) -> [
  MetricDistance,
  EuclideanDistance,
  ManhattanDistance,
  MinkowskiDistance,
  ChebyshevDistance,
  PointToPointDistance,
  PointToLineDistance,
  PointToSegmentDistance,
  PointToPlaneDistance,
  PointToSetDistance,
  SetDistance,
  HausdorffDistance,
  NearestPoint,
  ClosestPair,
  Projection,
  ScaleFactor,
  Unit,
  UnitConversion,
  ErrorBound
 ]

 EXPAND(MetricDistance) -> [
  Nonnegativity,
  IdentityOfIndiscernibles,
  Symmetry,
  TriangleInequality
 ]

 EXPAND(PointToSetDistance) -> [
  Infimum,
  NearestPoint,
  Projection,
  Compactness,
  Closedness
 ]

 EXPAND(HausdorffDistance) -> [
  DirectedDistance,
  Supremum,
  Infimum,
  SetComparison
 ]

 STOP_CONDITION =
  "Stop when the requested distance, metric, geometric relation, nearest-point status, scale, units and exactness are sufficiently resolved."
}

ROUTING {
 PARENT_ONTOLOGY = "Geometric Measurement"

 IMMEDIATE_CONTEXTS = [
  "Geometric Measurement",
  "Length Ontology",
  "Coordinate Geometry Ontology",
  "Metric Space Ontologies"
 ]

 RELATED_ONTOLOGIES = [
  "Geometric Measurement",
  "Length Ontology",
  "Coordinate Geometry Ontology",
  "Analytic Geometry Ontology",
  "Vector Geometry Ontology",
  "Line Ontology",
  "Line Segment Ontology",
  "Plane Ontologies",
  "Metric Space Ontologies",
  "Optimisation Ontologies",
  "Computational Geometry Ontology",
  "Measurement & Units Ontologies"
 ]

 ROUTE_RULES = [
  "Distance -> Geometric Measurement for parent quantitative semantics",
  "Distance -> Length for one-dimensional magnitude semantics",
  "Distance -> Coordinate Geometry for coordinate formulas",
  "Distance -> Vector Geometry for norms, projections and perpendicular distances",
  "Distance -> Metric Space for metric axioms",
  "Distance -> Optimisation for nearest-point and infimum problems",
  "Distance -> Computational Geometry for closest-pair and proximity problems",
  "Distance -> Measurement & Units for unit conversion"
 ]
}

UPDATE_MODEL {
 MODE = "append-compatible semantic versioning"

 MAJOR = "ontology-breaking conceptual change"
 MINOR = "new compatible distance metrics, geometric cases or reasoning pathways"
 PATCH = "clarification, metadata or formatting correction"

 RULES = [
  "Preserve metric-distance semantics.",
  "Preserve nonnegativity, symmetry and triangle inequality for metric contexts.",
  "Preserve point-to-set infimum semantics.",
  "Preserve distinction between minimum and infimum.",
  "Preserve metric dependence.",
  "Preserve linear scaling.",
  "Preserve unit dimensionality.",
  "Preserve machine-readable distance semantics."
 ]
}

OUTPUT {
 CANONICAL_DEFINITION =
  "Distance is a nonnegative measure of geometric separation under a specified metric."

 METRIC_SUMMARY =
  "A metric satisfies nonnegativity, identity, symmetry and triangle inequality."

 EUCLIDEAN_SUMMARY =
  "Euclidean distance is the L2 norm of coordinate difference."

 MANHATTAN_SUMMARY =
  "Manhattan distance is the L1 norm of coordinate difference."

 POINT_SET_SUMMARY =
  "dist(x,A)=inf_{a in A} d(x,a)."

 SET_SUMMARY =
  "dist(A,B)=inf_{a in A,b in B} d(a,b)."

 HAUSDORFF_SUMMARY =
  "Hausdorff distance is the maximum of the two directed worst-case nearest-point distances."

 SCALE_SUMMARY =
  "Similarity scaling by factor k changes distance by |k|."

 UNIT_SUMMARY =
  "Distance-unit conversion preserves the underlying magnitude."
}

FLOW {
 INPUT
 -> detect_distance_context
 -> identify entities_metric_coordinates_units_scale_and_precision
 -> classify point_point_point_line_point_segment_point_plane_point_set_set_set_or_Hausdorff goal
 -> select metric_formula_projection_or_optimisation method
 -> compute distance_minimum_or_infimum
 -> apply scale_or_unit_conversion when required
 -> verify nonnegativity_metric_axioms_dimension_domain_and_attainment constraints
 -> route to geometric_measurement length coordinate vector metric_space optimisation computational_geometry_or_units ontology
 -> recursively_expand_required_dependencies
 -> verify_result
 -> assign_confidence
 -> produce_semantic_output
 -> END
}

SEMANTIC_SUMMARY {
 "The Distance Ontology defines geometric separation under explicit metrics and supports Euclidean, Manhattan, Minkowski and Chebyshev distances, point-to-line, point-to-segment, point-to-plane and point-to-set distances, set and Hausdorff distances, nearest-point reasoning, scaling, units, dimensional analysis and approximation-aware computation."
}

FLOW_HASH {
 METHOD = "semantic-content-identity"
 ID = "KIRETH-MATH-GEOMETRY-DISTANCE-ONTOLOGY-V1"
}

}

END_FLOW
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ