1:- module(jgg, []). 2
3:- use_module(library(apply)). 4:- use_module(library(apply_macros)). 5:- use_module(library(statistics)). 6:- use_module(zdd('zdd-array')). 7:- use_module(util(math)). 8:- use_module(util(meta2)). 9:- use_module(pac(basic)). 10:- use_module(pac(meta)). 11:- use_module(util(misc)). 12:- use_module(pac(op)). 13
14
19
20bit_length([], 0).
21bit_length([B|Bs], L):- L>0,
22 (B=0; B=1),
23 L0 is L-1,
24 bit_length(Bs, L0).
26admissible([],[]).
27admissible([_],[_]).
28admissible([A,B|X], [C,D|Y]):-
29 \+ inadmissible(A,B,C,D),
30 admissible([B|X],[D|Y]).
32inadmissible(A, A, A, A).
33
34
35f(1,1).
36f(2,1).
37f(N,F):- N>2,
38 N0 is N -1,
39 N1 is N -2,
40 g(N0, F0),
41 g(N1, F1),
42 F is F0 + F1.
44g(1,0).
45g(2,1).
46g(N, G):- N>2,
47 N0 is N -1,
48 N1 is N -2,
49 f(N0, G0),
50 f(N1, G1),
51 G is G0 + G1