Challenge 1: findall/3 Over Every Parent-Child Pair — Possible Solution ==================================================================== family.pl: parent(tom, bob). parent(tom, liz). parent(bob, ann). parent(bob, pat). parent(liz, jim). Query: ?- findall(Parent-Child, parent(Parent, Child), Pairs). Pairs = [tom-bob, tom-liz, bob-ann, bob-pat, liz-jim]. Explanation: The template here is the compound term Parent-Child (Prolog's "-" operator works perfectly well as an ordinary two-argument functor for building simple pair terms, not just for arithmetic subtraction). findall runs parent(Parent, Child) to exhaustion via backtracking, and for each solution it finds, it builds one Parent-Child term using whatever Parent and Child were bound to at that point, collecting all five into a single list in the order the facts were tried. Unlike bagof, findall never groups these by Parent -- every pair lands in one flat list regardless of which parent it came from. WHY THIS WORKS AS AN ANSWER ------------------------------ This uses findall's Template argument to build a compound term rather than just collecting a single variable, demonstrating that the template can be any term built from a query's bound variables, and confirms findall's flat, ungrouped, all-in-one-list behavior over the whole database.