Find flight routes from Ostend to Prague in a network of 7,698 airports.
path-discovery.pl · output · proof · check · try it in the playground
You want to fly from Ostend-Bruges to Prague, changing planes at most twice. A stopover is an airport where you change planes on the way.
Which routes are there? No airport may be visited twice.
The data is a historical snapshot of airport connections, not today’s timetable.
The file holds 7,698 airports and 37,505 one-way connections:
airport('AIRPORT_1', 'Goroka Airport').
airport('AIRPORT_10', 'Thule Air Base').
% … 7,696 more airports …
flight('AIRPORT_1', 'AIRPORT_2').
flight('AIRPORT_1', 'AIRPORT_3').
% … 37,503 more connections …
flight(A, B) means there is a connection from A to B. That is about
1.9 MB of facts, followed by a few rules.
route_airports(From, To, _, Visited, [From, To]) :-
flight(From, To), unvisited(To, Visited).
route_airports(From, To, Remaining, Visited, [From|Rest]) :-
Remaining > 0,
flight(From, Via), Via \= To, unvisited(Via, Visited),
Next is Remaining-1,
route_airports(Via, To, Next, [Via|Visited], Rest).
Via and continue from
there with one stopover fewer.path_discovery wraps this, turning names into ids and back.
Three routes, all through Liège:
Ostend-Bruges → Liège → Heraklion International Nikos Kazantzakis → Prague
Ostend-Bruges → Liège → Diagoras Airport → Prague
Ostend-Bruges → Liège → Palma De Mallorca → Prague
The real output lists the full names, for example:
['Ostend-Bruges International Airport', 'Liège Airport', 'Diagoras Airport', 'Václav Havel Airport Prague'].
For the Heraklion route, the proof records:
“Not yet visited” is shown by comparing against each earlier airport, one by one, so even that part is spelled out.
Out of 37,505 connections, the proof cites only the handful each route uses. It has 76 steps behind the 3 routes:
Verdict: checked. Nothing taken on trust: the “no repeats” rule uses explicit “is not the same as” tests rather than “cannot be shown”, so it leaves no obligations.
node bin/eyedia.js examples/path-discovery.pl
node bin/eyedia.js --goal "path_discovery('Liège Airport', 'Václav Havel Airport Prague', 1, Path)" examples/path-discovery.pl
Or open it in the playground.
With 0 stopovers only direct flights count:
--goal "path_discovery('Ostend-Bruges International Airport', 'Liège Airport', 0, Path)"
gives the single route Ostend-Bruges → Liège.
Even in a large dataset, an answer’s proof stays small: it names only the flights that route uses, and every one of them can be checked against the data.