:-use_module(library(clpfd)).


% N is the dot product of lists V1 and V2.
dot(V1, V2, N) :- maplist(product,V1,V2,P), sumlist(P,N).
product(N1,N2,N3) :- N3 is N1*N2.

% Matrix multiplication with matrices represented
% as lists of lists. M3 is the product of M1 and M2
mmult(M1, M2, M3) :- transpose(M2,MT), maplist(mm_helper(MT), M1, M3).
mm_helper(M2, I1, M3) :- maplist(dot(I1), M2, M3).


suml([],[],[]).

suml(L1,L2,[E1 + E2|R2]):-
    L1 = [E1|T1],
    L2 = [E2|T2],
    suml(T1,T2,R2).



summ([],[],[]).
summ(M1,M2,[Lr|R2]):-
    M1 = [E1|T1],
    M2 = [E2|T2],
    suml(E1,E2,Lr),
    summ(T1,T2,R2).


flatten(List, Flattened):-
  flatten(List, [], Flattened).

flatten([], Flattened, Flattened).
flatten([Item|Tail], L, Flattened):-
  flatten(Item, L1, Flattened),
  flatten(Tail, L, L1).
flatten(Item, Flattened, [Item|Flattened]):-
  \+ is_list(Item).

touspositifs(X):-
    flatten(X,XF),
    tp(XF).

tp([]).
tp(X):-
    X = [E|L],
    E #> 0,
    tp(L).


sc4(X1):-
	 mmult(X1,X1,X2),
	 mmult(X1,X2,X3),
	 mmult(X1,X3,X4),
	 mmult(X1,X4,X5),
	 mmult(X1,X5,X6),
	 mmult(X1,X6,X7),
	 mmult(X1,X7,X8),
	 mmult(X1,X8,X9),
	 mmult(X1,X9,X10),
	 mmult(X1,X10,X11),
	 mmult(X1,X11,X12),
	 mmult(X1,X12,X13),
	 mmult(X1,X13,X14),
	 mmult(X1,X14,X15),
	 mmult(X1,X15,X16),
	 summ(X1,X2,S2),
	 summ(S2,X3,S3),
	 summ(S3,X4,S4),
	 summ(S4,X5,S5),
	 summ(S5,X6,S6),
	 summ(S6,X7,S7),
	 summ(S7,X8,S8),
	 summ(S8,X9,S9),
	 summ(S9,X10,S10),
	 summ(S10,X11,S11),
	 summ(S11,X12,S12),
	 summ(S12,X13,S13),
	 summ(S13,X14,S14),
	 summ(S14,X15,S15),
	 summ(S15,X16,S16),
	 touspositifs(S16).

bistoc(X):-
	 X=[[M0X0, M0X1, M0X2, M0X3, M0X4, M0X5, M0X6, M0X7, M0X8, M0X9, M0X10, M0X11, M0X12, M0X13, M0X14, M0X15], [M1X0, M1X1, M1X2, M1X3, M1X4, M1X5, M1X6, M1X7, M1X8, M1X9, M1X10, M1X11, M1X12, M1X13, M1X14, M1X15], [M2X0, M2X1, M2X2, M2X3, M2X4, M2X5, M2X6, M2X7, M2X8, M2X9, M2X10, M2X11, M2X12, M2X13, M2X14, M2X15], [M3X0, M3X1, M3X2, M3X3, M3X4, M3X5, M3X6, M3X7, M3X8, M3X9, M3X10, M3X11, M3X12, M3X13, M3X14, M3X15], [M4X0, M4X1, M4X2, M4X3, M4X4, M4X5, M4X6, M4X7, M4X8, M4X9, M4X10, M4X11, M4X12, M4X13, M4X14, M4X15], [M5X0, M5X1, M5X2, M5X3, M5X4, M5X5, M5X6, M5X7, M5X8, M5X9, M5X10, M5X11, M5X12, M5X13, M5X14, M5X15], [M6X0, M6X1, M6X2, M6X3, M6X4, M6X5, M6X6, M6X7, M6X8, M6X9, M6X10, M6X11, M6X12, M6X13, M6X14, M6X15], [M7X0, M7X1, M7X2, M7X3, M7X4, M7X5, M7X6, M7X7, M7X8, M7X9, M7X10, M7X11, M7X12, M7X13, M7X14, M7X15], [M8X0, M8X1, M8X2, M8X3, M8X4, M8X5, M8X6, M8X7, M8X8, M8X9, M8X10, M8X11, M8X12, M8X13, M8X14, M8X15], [M9X0, M9X1, M9X2, M9X3, M9X4, M9X5, M9X6, M9X7, M9X8, M9X9, M9X10, M9X11, M9X12, M9X13, M9X14, M9X15], [M10X0, M10X1, M10X2, M10X3, M10X4, M10X5, M10X6, M10X7, M10X8, M10X9, M10X10, M10X11, M10X12, M10X13, M10X14, M10X15], [M11X0, M11X1, M11X2, M11X3, M11X4, M11X5, M11X6, M11X7, M11X8, M11X9, M11X10, M11X11, M11X12, M11X13, M11X14, M11X15], [M12X0, M12X1, M12X2, M12X3, M12X4, M12X5, M12X6, M12X7, M12X8, M12X9, M12X10, M12X11, M12X12, M12X13, M12X14, M12X15], [M13X0, M13X1, M13X2, M13X3, M13X4, M13X5, M13X6, M13X7, M13X8, M13X9, M13X10, M13X11, M13X12, M13X13, M13X14, M13X15], [M14X0, M14X1, M14X2, M14X3, M14X4, M14X5, M14X6, M14X7, M14X8, M14X9, M14X10, M14X11, M14X12, M14X13, M14X14, M14X15], [M15X0, M15X1, M15X2, M15X3, M15X4, M15X5, M15X6, M15X7, M15X8, M15X9, M15X10, M15X11, M15X12, M15X13, M15X14, M15X15]],
	 M0X0 in 0..4,
	 M0X1 in 0..1,
	 M0X2 in 0..1,
	 M0X3 is 0 ,
	 M0X4 in 0..1,
	 M0X5 is 0 ,
	 M0X6 is 0 ,
	 M0X7 is 0 ,
	 M0X8 in 0..1,
	 M0X9 is 0 ,
	 M0X10 is 0 ,
	 M0X11 is 0 ,
	 M0X12 is 0 ,
	 M0X13 is 0 ,
	 M0X14 is 0 ,
	 M0X15 is 0 ,
	 M1X0 in 0..1,
	 M1X1 in 0..4,
	 M1X2 is 0 ,
	 M1X3 in 0..1,
	 M1X4 is 0 ,
	 M1X5 in 0..1,
	 M1X6 is 0 ,
	 M1X7 is 0 ,
	 M1X8 is 0 ,
	 M1X9 in 0..1,
	 M1X10 is 0 ,
	 M1X11 is 0 ,
	 M1X12 is 0 ,
	 M1X13 is 0 ,
	 M1X14 is 0 ,
	 M1X15 is 0 ,
	 M2X0 in 0..1,
	 M2X1 is 0 ,
	 M2X2 in 0..4,
	 M2X3 in 0..1,
	 M2X4 is 0 ,
	 M2X5 is 0 ,
	 M2X6 in 0..1,
	 M2X7 is 0 ,
	 M2X8 is 0 ,
	 M2X9 is 0 ,
	 M2X10 in 0..1,
	 M2X11 is 0 ,
	 M2X12 is 0 ,
	 M2X13 is 0 ,
	 M2X14 is 0 ,
	 M2X15 is 0 ,
	 M3X0 is 0 ,
	 M3X1 in 0..1,
	 M3X2 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0 ,
	 M7X12 is 0 ,
	 M7X13 is 0 ,
	 M7X14 is 0 ,
	 M7X15 in 0..1,
	 M8X0 in 0..1,
	 M8X1 is 0 ,
	 M8X2 is 0 ,
	 M8X3 is 0 ,
	 M8X4 is 0 ,
	 M8X5 is 0 ,
	 M8X6 is 0 ,
	 M8X7 is 0 ,
	 M8X8 in 0..4,
	 M8X9 in 0..1,
	 M8X10 in 0..1,
	 M8X11 is 0 ,
	 M8X12 in 0..1,
	 M8X13 is 0 ,
	 M8X14 is 0 ,
	 M8X15 is 0 ,
	 M9X0 is 0 ,
	 M9X1 in 0..1,
	 M9X2 is 0 ,
	 M9X3 is 0 ,
	 M9X4 is 0 ,
	 M9X5 is 0 ,
	 M9X6 is 0 ,
	 M9X7 is 0 ,
	 M9X8 in 0..1,
	 M9X9 in 0..4,
	 M9X10 is 0 ,
	 M9X11 in 0..1,
	 M9X12 is 0 ,
	 M9X13 in 0..1,
	 M9X14 is 0 ,
	 M9X15 is 0 ,
	 M10X0 is 0 ,
	 M10X1 is 0 ,
	 M10X2 in 0..1,
	 M10X3 is 0 ,
	 M10X4 is 0 ,
	 M10X5 is 0 ,
	 M10X6 is 0 ,
	 M10X7 is 0 ,
	 M10X8 in 0..1,
	 M10X9 is 0 ,
	 M10X10 in 0..4,
	 M10X11 in 0..1,
	 M10X12 is 0 ,
	 M10X13 is 0 ,
	 M10X14 in 0..1,
	 M10X15 is 0 ,
	 M11X0 is 0 ,
	 M11X1 is 0 ,
	 M11X2 is 0 ,
	 M11X3 in 0..1,
	 M11X4 is 0 ,
	 M11X5 is 0 ,
	 M11X6 is 0 ,
	 M11X7 is 0 ,
	 M11X8 is 0 ,
	 M11X9 in 0..1,
	 M11X10 in 0..1,
	 M11X11 in 0..4,
	 M11X12 is 0 ,
	 M11X13 is 0 ,
	 M11X14 is 0 ,
	 M11X15 in 0..1,
	 M12X0 is 0 ,
	 M12X1 is 0 ,
	 M12X2 is 0 ,
	 M12X3 is 0 ,
	 M12X4 in 0..1,
	 M12X5 is 0 ,
	 M12X6 is 0 ,
	 M12X7 is 0 ,
	 M12X8 in 0..1,
	 M12X9 is 0 ,
	 M12X10 is 0 ,
	 M12X11 is 0 ,
	 M12X12 in 0..4,
	 M12X13 in 0..1,
	 M12X14 in 0..1,
	 M12X15 is 0 ,
	 M13X0 is 0 ,
	 M13X1 is 0 ,
	 M13X2 is 0 ,
	 M13X3 is 0 ,
	 M13X4 is 0 ,
	 M13X5 in 0..1,
	 M13X6 is 0 ,
	 M13X7 is 0 ,
	 M13X8 is 0 ,
	 M13X9 in 0..1,
	 M13X10 is 0 ,
	 M13X11 is 0 ,
	 M13X12 in 0..1,
	 M13X13 in 0..4,
	 M13X14 is 0 ,
	 M13X15 in 0..1,
	 M14X0 is 0 ,
	 M14X1 is 0 ,
	 M14X2 is 0 ,
	 M14X3 is 0 ,
	 M14X4 is 0 ,
	 M14X5 is 0 ,
	 M14X6 in 0..1,
	 M14X7 is 0 ,
	 M14X8 is 0 ,
	 M14X9 is 0 ,
	 M14X10 in 0..1,
	 M14X11 is 0 ,
	 M14X12 in 0..1,
	 M14X13 is 0 ,
	 M14X14 in 0..4,
	 M14X15 in 0..1,
	 M15X0 is 0 ,
	 M15X1 is 0 ,
	 M15X2 is 0 ,
	 M15X3 is 0 ,
	 M15X4 is 0 ,
	 M15X5 is 0 ,
	 M15X6 is 0 ,
	 M15X7 in 0..1,
	 M15X8 is 0 ,
	 M15X9 is 0 ,
	 M15X10 is 0 ,
	 M15X11 in 0..1,
	 M15X12 is 0 ,
	 M15X13 in 0..1,
	 M15X14 in 0..1,
	 M15X15 in 0..4,
	 M0X0+ M0X1+ M0X2+ M0X3+ M0X4+ M0X5+ M0X6+ M0X7+ M0X8+ M0X9+ M0X10+ M0X11+ M0X12+ M0X13+ M0X14+ M0X15 #=4 ,
	 M1X0+ M1X1+ M1X2+ M1X3+ M1X4+ M1X5+ M1X6+ M1X7+ M1X8+ M1X9+ M1X10+ M1X11+ M1X12+ M1X13+ M1X14+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11X12+ M11X13+ M11X14+ M11X15 #=4 ,
	 M12X0+ M12X1+ M12X2+ M12X3+ M12X4+ M12X5+ M12X6+ M12X7+ M12X8+ M12X9+ M12X10+ M12X11+ M12X12+ M12X13+ M12X14+ M12X15 #=4 ,
	 M13X0+ M13X1+ M13X2+ M13X3+ M13X4+ M13X5+ M13X6+ M13X7+ M13X8+ M13X9+ M13X10+ M13X11+ M13X12+ M13X13+ M13X14+ M13X15 #=4 ,
	 M14X0+ M14X1+ M14X2+ M14X3+ M14X4+ M14X5+ M14X6+ M14X7+ M14X8+ M14X9+ M14X10+ M14X11+ M14X12+ M14X13+ M14X14+ M14X15 #=4 ,
	 M15X0+ M15X1+ M15X2+ M15X3+ M15X4+ M15X5+ M15X6+ M15X7+ M15X8+ M15X9+ M15X10+ M15X11+ M15X12+ M15X13+ M15X14+ M15X15 #=4 ,
	 M0X0+ M0X1+ M0X2+ M0X3+ M0X4+ M0X5+ M0X6+ M0X7+ M0X8+ M0X9+ M0X10+ M0X11+ M0X12+ M0X13+ M0X14+ M0X15 #=4 ,
	 M0X0+ M1X0+ M2X0+ M3X0+ M4X0+ M5X0+ M6X0+ M7X0+ M8X0+ M9X0+ M10X0+ M11X0+ M12X0+ M13X0+ M14X0+ M15X0 #=4 ,
	 M1X0+ M1X1+ M1X2+ M1X3+ M1X4+ M1X5+ M1X6+ M1X7+ M1X8+ M1X9+ M1X10+ M1X11+ M1X12+ M1X13+ M1X14+ M1X15 #=4 ,
	 M0X1+ M1X1+ M2X1+ M3X1+ M4X1+ M5X1+ M6X1+ M7X1+ M8X1+ M9X1+ M10X1+ M11X1+ M12X1+ M13X1+ M14X1+ M15X1 #=4 ,
	 M2X0+ M2X1+ M2X2+ M2X3+ M2X4+ M2X5+ M2X6+ M2X7+ M2X8+ M2X9+ M2X10+ M2X11+ M2X12+ M2X13+ M2X14+ M2X15 #=4 ,
	 M0X2+ M1X2+ M2X2+ M3X2+ M4X2+ M5X2+ M6X2+ M7X2+ M8X2+ M9X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 M7X7+ M8X7+ M9X7+ M10X7+ M11X7+ M12X7+ M13X7+ M14X7+ M15X7 #=4 ,
	 M8X0+ M8X1+ M8X2+ M8X3+ M8X4+ M8X5+ M8X6+ M8X7+ M8X8+ M8X9+ M8X10+ M8X11+ M8X12+ M8X13+ M8X14+ M8X15 #=4 ,
	 M0X8+ M1X8+ M2X8+ M3X8+ M4X8+ M5X8+ M6X8+ M7X8+ M8X8+ M9X8+ M10X8+ M11X8+ M12X8+ M13X8+ M14X8+ M15X8 #=4 ,
	 M9X0+ M9X1+ M9X2+ M9X3+ M9X4+ M9X5+ M9X6+ M9X7+ M9X8+ M9X9+ M9X10+ M9X11+ M9X12+ M9X13+ M9X14+ M9X15 #=4 ,
	 M0X9+ M1X9+ M2X9+ M3X9+ M4X9+ M5X9+ M6X9+ M7X9+ M8X9+ M9X9+ M10X9+ M11X9+ M12X9+ M13X9+ M14X9+ M15X9 #=4 ,
	 M10X0+ M10X1+ M10X2+ M10X3+ M10X4+ M10X5+ M10X6+ M10X7+ M10X8+ M10X9+ M10X10+ M10X11+ M10X12+ M10X13+ M10X14+ M10X15 #=4 ,
	 M0X10+ M1X10+ M2X10+ M3X10+ M4X10+ M5X10+ M6X10+ M7X10+ M8X10+ M9X10+ M10X10+ M11X10+ M12X10+ M13X10+ M14X10+ M15X10 #=4 ,
	 M11X0+ M11X1+ M11X2+ M11X3+ M11X4+ M11X5+ M11X6+ M11X7+ M11X8+ M11X9+ M11X10+ M11X11+ M11X12+ M11X13+ M11X14+ M11X15 #=4 ,
	 M0X11+ M1X11+ M2X11+ M3X11+ M4X11+ M5X11+ M6X11+ M7X11+ M8X11+ M9X11+ M10X11+ M11X11+ M12X11+ M13X11+ M14X11+ M15X11 #=4 ,
	 M12X0+ M12X1+ M12X2+ M12X3+ M12X4+ M12X5+ M12X6+ M12X7+ M12X8+ M12X9+ M12X10+ M12X11+ M12X12+ M12X13+ M12X14+ M12X15 #=4 ,
	 M0X12+ M1X12+ M2X12+ M3X12+ M4X12+ M5X12+ M6X12+ M7X12+ M8X12+ M9X12+ M10X12+ M11X12+ M12X12+ M13X12+ M14X12+ M15X12 #=4 ,
	 M13X0+ M13X1+ M13X2+ M13X3+ M13X4+ M13X5+ M13X6+ M13X7+ M13X8+ M13X9+ M13X10+ M13X11+ M13X12+ M13X13+ M13X14+ M13X15 #=4 ,
	 M0X13+ M1X13+ M2X13+ M3X13+ M4X13+ M5X13+ M6X13+ M7X13+ M8X13+ M9X13+ M10X13+ M11X13+ M12X13+ M13X13+ M14X13+ M15X13 #=4 ,
	 M14X0+ M14X1+ M14X2+ M14X3+ M14X4+ M14X5+ M14X6+ M14X7+ M14X8+ M14X9+ M14X10+ M14X11+ M14X12+ M14X13+ M14X14+ M14X15 #=4 ,
	 M0X14+ M1X14+ M2X14+ M3X14+ M4X14+ M5X14+ M6X14+ M7X14+ M8X14+ M9X14+ M10X14+ M11X14+ M12X14+ M13X14+ M14X14+ M15X14 #=4 ,
	 M15X0+ M15X1+ M15X2+ M15X3+ M15X4+ M15X5+ M15X6+ M15X7+ M15X8+ M15X9+ M15X10+ M15X11+ M15X12+ M15X13+ M15X14+ M15X15 #=4 ,
	 M0X15+ M1X15+ M2X15+ M3X15+ M4X15+ M5X15+ M6X15+ M7X15+ M8X15+ M9X15+ M10X15+ M11X15+ M12X15+ M13X15+ M14X15+ M15X15 #=4 ,
	 label([M0X0, M0X1, M0X2, M0X3, M0X4, M0X5, M0X6, M0X7, M0X8, M0X9, M0X10, M0X11, M0X12, M0X13, M0X14, M0X15, M1X0, M1X1, M1X2, M1X3, M1X4, M1X5, M1X6, M1X7, M1X8, M1X9, M1X10, M1X11, M1X12, M1X13, M1X14, M1X15, M2X0, M2X1, M2X2, M2X3, M2X4, M2X5, M2X6, M2X7, M2X8, M2X9, M2X10, M2X11, M2X12, M2X13, M2X14, M2X15, M3X0, M3X1, M3X2, M3X3, M3X4, M3X5, M3X6, M3X7, M3X8, M3X9, M3X10, M3X11, M3X12, M3X13, M3X14, M3X15, M4X0, M4X1, M4X2, M4X3, M4X4, M4X5, M4X6, M4X7, M4X8, M4X9, M4X10, M4X11, M4X12, M4X13, M4X14, M4X15, M5X0, M5X1, M5X2, M5X3, M5X4, M5X5, M5X6, M5X7, M5X8, M5X9, M5X10, M5X11, M5X12, M5X13, M5X14, M5X15, M6X0, M6X1, M6X2, M6X3, M6X4, M6X5, M6X6, M6X7, M6X8, M6X9, M6X10, M6X11, M6X12, M6X13, M6X14, M6X15, M7X0, M7X1, M7X2, M7X3, M7X4, M7X5, M7X6, M7X7, M7X8, M7X9, M7X10, M7X11, M7X12, M7X13, M7X14, M7X15, M8X0, M8X1, M8X2, M8X3, M8X4, M8X5, M8X6, M8X7, M8X8, M8X9, M8X10, M8X11, M8X12, M8X13, M8X14, M8X15, M9X0, M9X1, M9X2, M9X3, M9X4, M9X5, M9X6, M9X7, M9X8, M9X9, M9X10, M9X11, M9X12, M9X13, M9X14, M9X15, M10X0, M10X1, M10X2, M10X3, M10X4, M10X5, M10X6, M10X7, M10X8, M10X9, M10X10, M10X11, M10X12, M10X13, M10X14, M10X15, M11X0, M11X1, M11X2, M11X3, M11X4, M11X5, M11X6, M11X7, M11X8, M11X9, M11X10, M11X11, M11X12, M11X13, M11X14, M11X15, M12X0, M12X1, M12X2, M12X3, M12X4, M12X5, M12X6, M12X7, M12X8, M12X9, M12X10, M12X11, M12X12, M12X13, M12X14, M12X15, M13X0, M13X1, M13X2, M13X3, M13X4, M13X5, M13X6, M13X7, M13X8, M13X9, M13X10, M13X11, M13X12, M13X13, M13X14, M13X15, M14X0, M14X1, M14X2, M14X3, M14X4, M14X5, M14X6, M14X7, M14X8, M14X9, M14X10, M14X11, M14X12, M14X13, M14X14, M14X15, M15X0, M15X1, M15X2, M15X3, M15X4, M15X5, M15X6, M15X7, M15X8, M15X9, M15X10, M15X11, M15X12, M15X13, M15X14, M15X15]),
	 sc4(X), 
	 open('res4.txt',append,Stream),
	 write(Stream,X),
	 close(Stream).



    

display_m([]).
display_m([El|R]):-
    write(El),
    display_m(R).


solution(L):-
    get_time(T0),
    findall(X,bistoc(X),L),
    get_time(T1),
    DT is T1 - T0,
    write('but : '),writeln(DT),
    display_m(L).




