%%   知識情報処理実習 r11の練習問題 解答例

% 基本プログラムコース
n_of_nodes(a,1).
n_of_nodes(b,0).
n_of_nodes(t(L,T),N) :- n_of_nodes(L,N0),  n_of_nodes(T,N1), N is N0+N1.
n_of_nodes(t(L,T1,T2),N) :- 
    n_of_nodes(L,N0),  n_of_nodes(T1,N1), n_of_nodes(T2,N2), N is N0+N1+N2.

test11(K) :- n_of_nodes( t(a,t(a,b,a),t(a,b)), K ).