The Magic-Set Transformed rules for the trip program:
trip(L,S,E):-leg(L,S,E).
trip(L,S,E):-leg(L,S,I), trip(L,I,E).
trip(L,S,E):-interchange(I,L,M), trip(L,S,I), trip(M,I,E).
query(X):-trip(blue, suwanee, X).

Adorned Rules:

query_f(X):-trip_bbf(blue,suwanee,X).
trip_bbf(L,S,E):-leg(L,S,E).
trip_bbf(L,S,E):-leg(L,S,I), trip_bbf(L,I,E).
trip_bbf(L,S,E):-interchange(I,L,M), trip_bbb(L,S,I), trip_bbf(M,I,E).
trip_bbb(L,S,E):-leg(L,S,E).
trip_bbb(L,S,E):-leg(L,S,I), trip_bbb(L,I,E).
trip_bbb(L,S,E):-interchange(I,L,M), trip_bbb(L,S,I), trip_bbb(M,I,E).


Magic Rules:

magic_trip_bbf(blue,suwanee).
magic_trip_bbf(L,I):-leg(L,S,I),magic_trip_bbf(L,S).
magic_trip_bbb(L,S,I):-interchange(I,L,M),magic_trip_bbf(L,S).
magic_trip_bbf(M,I):-interchange(I,L,M),magic_trip_bbf(L,S).
magic_trip_bbb(L,I,E):-leg(L,S,I),magic_trip_bbb(L,S,E).
magic_trip_bbb(L,S,I):-interchange(I,L,M),magic_trip_bbb(L,S,E).
magic_trip_bbb(M,I,E):-interchange(I,L,M),magic_trip_bbb(L,S,E).


Modified Adorned Rules:

query_f(X):-trip_bbf(blue,suwanee,X).
trip_bbf(L,S,E):-leg(L,S,E),magic_trip_bbf(L,S).
trip_bbf(L,S,E):-leg(L,S,I), trip_bbf(L,I,E),magic_trip_bbf(L,S).
trip_bbf(L,S,E):-interchange(I,L,M), trip_bbb(L,S,I), trip_bbf(M,I,E),magic_trip_bbf(L,S).
trip_bbb(L,S,E):-leg(L,S,E),magic_trip_bbb(L,S,E).
trip_bbb(L,S,E):-leg(L,S,I), trip_bbb(L,I,E),magic_trip_bbb(L,S,E).
trip_bbb(L,S,E):-interchange(I,L,M), trip_bbb(L,S,I), trip_bbb(M,I,E),magic_trip_bbb(L,S,E).


Output: Magic Rules + Modified Adorned Rules