% 商品データ
product(item1, 3000, 4.8, 20).
product(item2, 1800, 4.2, 200).
product(item3, 5000, 4.9, 5).
product(item4, 2500, 4.5, 80).

% おすすめの定義（評価4.5以上かつレビュー50件以上、または評価4.8以上）
recommended(Item) :-
    product(Item, _, Rating, Reviews),
    (Rating >= 4.5, Reviews >= 50 ; Rating >= 4.8).

% おすすめ商品を一覧表示するためのプログラム
show_recommended :-
    write('--- おすすめ商品リスト ---'), nl,
    recommended(Item),
    product(Item, Price, Rating, Reviews),
    format('商品名: ~w (価格: ~w円, 評価: ~w, レビュー数: ~w件)~n', [Item, Price, Rating, Reviews]),
    fail. % 全ての商品をチェックするために失敗させてバックトラックさせる
show_recommended :-
    nl, write('--- 以上がおすすめ商品です ---'), nl.