Challenge 2: append/3 Forward and Backward — Possible Solution ==================================================================== Forward (concatenation): ?- append([1, 2], [3, 4], X). X = [1, 2, 3, 4]. Backward (finding every split): ?- append(X, Y, [1, 2, 3, 4]). X = [], Y = [1, 2, 3, 4] ; X = [1], Y = [2, 3, 4] ; X = [1, 2], Y = [3, 4] ; X = [1, 2, 3], Y = [4] ; X = [1, 2, 3, 4], Y = []. Explanation: The forward query supplies both pieces (X and Y are already concrete lists) and asks append/3 to compute their concatenation directly -- ordinary, expected behavior. The backward query instead supplies only the FINAL, already-concatenated list, leaving X and Y as unbound variables -- append/3's own single definition, run through backtracking, searches for every possible pair of lists that could have concatenated to produce [1, 2, 3, 4], finding all five genuine splits (including the two "empty piece" edge cases) without any separate "reverse append" predicate ever being written. WHY THIS WORKS AS AN ANSWER ------------------------------ This runs the exact same append/3 predicate in both the chapter's own forward and backward directions, showing all five real splits the backward direction finds via backtracking, confirming append/3's genuine bidirectionality.