OKlibrary  0.2.1.6
BasicOperations.mac
Go to the documentation of this file.
00001 /* Oliver Kullmann, 28.1.2008 (Swansea) */
00002 /* Copyright 2008, 2009, 2010, 2011, 2012, 2013 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00022 oklib_include("OKlib/ComputerAlgebra/TestSystem/Lisp/Asserts.mac")$
00023 oklib_include("OKlib/ComputerAlgebra/Hypergraphs/Lisp/SetSystems.mac")$
00024 oklib_include("OKlib/ComputerAlgebra/Satisfiability/Lisp/Generators/Pigeonhole.mac")$
00025 oklib_include("OKlib/ComputerAlgebra/Satisfiability/Lisp/ClauseSets/BasicOperations.mac")$
00026 oklib_include("OKlib/ComputerAlgebra/DataStructures/Lisp/Strings.mac")$
00027 
00028 
00029 kill(f)$
00030 
00031 /* **************************
00032    * Variables and literals *
00033    **************************
00034 */
00035 
00036 okltest_v_p(f) := block([x],
00037   assert(f("x") = false),
00038   assert(f(1) = true),
00039   assert(f(0) = false),
00040   assert(f(-1) = false),
00041   assert(f(x) = false),
00042   assert(f(php(3,4)) = true),
00043   true)$
00044 
00045 okltest_l_p(f) := block([x],
00046   assert(f(1) = true),
00047   assert(f(0) = false),
00048   assert(f(-1) = true),
00049   assert(f(x) = false),
00050   assert(f(php(3,4)) = true),
00051   assert(f(-php(3,4)) = true),
00052   true)$
00053 
00054 
00055 okltest_var_l(f) := (
00056   for i : 1 thru 10 do (
00057     assert(f(i) = i),
00058     assert(f(-i) = i)
00059   ),
00060   true
00061 )$
00062 
00063 okltest_sign_l(f) := (
00064   for i : 1 thru 10 do (
00065     assert(f(i) = 1),
00066     assert(f(-i) = -1)
00067   ),
00068   true
00069 )$
00070 
00071 okltest_pos_l(f) := (
00072   assert(f(1) = true),
00073   assert(f(-1) = false),
00074   true)$
00075 
00076 okltest_neg_l(f) := (
00077   assert(f(1) = false),
00078   assert(f(-1) = true),
00079   true)$
00080 
00081 okltest_literals_v(f) := (
00082   assert(f({}) = {}),
00083   assert(f({1}) = {1,-1}),
00084   assert(f({1,2}) = {1,-1,2,-2}),
00085   assert(f({-1}) = {1,-1}),
00086   assert(f({1,-2}) = {1,-1,2,-2}),
00087   assert(f({1,-2,-1}) = {1,-1,2,-2}),
00088   true)$
00089 
00090 okltest_gv(f) := block([a],
00091   assert(v_p(f()) = true),
00092   assert(v_p(f(1)) = true),
00093   assert(v_p(f(1,2,[],{})) = true),
00094   /* assert(v_p(f("hh")) = true), */ /* BUG with Maxima */
00095   assert(v_p(f(a)) = true),
00096   assert(is(f(1) = f(1)) = true),
00097   assert(is(f(1) = f(2)) = false),
00098   assert(is(f(1) = f(a)) = false),
00099   assert(is(f(a) = f(a)) = true),
00100   assert(is(gv_var(a) = f(a)) = true),
00101   true)$
00102 
00103 
00104 /* ***********
00105    * Clauses *
00106    ***********
00107 */
00108 
00109 okltest_comp_sl(f) := (
00110   assert(f({}) = {}),
00111   assert(f({1}) = {-1}),
00112   assert(f({-1}) = {1}),
00113   assert(f({1,-2}) = {-1,2}),
00114   assert(f({1,-1}) = {1,-1}),
00115   assert(f({2,-2,1,-3}) = {2,-2,-1,3}),
00116   true)$
00117 
00118 okltest_c_p(f) := block([x],
00119   assert(f({}) = true),
00120   assert(f([]) = false),
00121   assert(f(1) = false),
00122   assert(f(-1) = false),
00123   assert(f(0) = false),
00124   assert(f({1}) = true),
00125   assert(f({[]}) = false),
00126   assert(f({1,-2}) = true),
00127   assert(f({1,-1}) = false),
00128   assert(f(x) = false),
00129   assert(f({x}) = false),
00130   assert(okltest_l_p(buildq([f],lambda([x],f({x}))))),
00131   true)$
00132 
00133 okltest_clashp(f) := (
00134   assert(f({},{}) = false),
00135   assert(f({1},{}) = false),
00136   assert(f({},{1}) = false),
00137   assert(f({1},{1}) = false),
00138   assert(f({1},{-1}) = true),
00139   assert(f({1,2},{-2,3}) = true),
00140   true)$
00141 
00142 okltest_var_sl(f) := (
00143   assert(f({}) = {}),
00144   assert(f({1}) = {1}),
00145   assert(f({1,-2}) = {1,2}),
00146   assert(f({1,-1,2,-3}) = {1,2,3}),
00147   true)$
00148 
00149 okltest_pospart_c(f) := (
00150   assert(f({}) = {}),
00151   assert(f({-1}) = {}),
00152   assert(f({1}) = {1}),
00153   assert(f({1,-2,3,-4}) = {1,3}),
00154   true)$
00155 
00156 okltest_negpart_c(f) := (
00157   assert(okltest_pospart_c(buildq([f],lambda([C],comp_sl(f(comp_sl(C))))))),
00158   true)$
00159 
00160 okltest_posp_c(f) := (
00161   assert(f({}) = true),
00162   assert(f({-1}) = false),
00163   assert(f({1}) = true),
00164   assert(f({1,2}) = true),
00165   assert(f({1,-2}) = false),
00166   true)$
00167 
00168 okltest_negp_c(f) := (
00169   assert(f({}) = true),
00170   assert(f({-1}) = true),
00171   assert(f({1}) = false),
00172   assert(f({-1,-2}) = true),
00173   assert(f({-1,2}) = false),
00174   true)$
00175 
00176 
00177 /* ***************
00178    * Clause-sets *
00179    ***************
00180 */
00181 
00182 okltest_cs_p(f) := block([x],
00183   assert(f({}) = true),
00184   assert(f({{}}) = true),
00185   assert(f([]) = false),
00186   assert(f([[]]) = false),
00187   assert(f({1}) = false),
00188   assert(f({-1}) = false),
00189   assert(f({x}) = false),
00190   assert(f({{x}}) = false),
00191   assert(f({{1},{-1}}) = true),
00192   assert(f({{1,-1}}) = false),
00193   assert(f({{},[]}) = false),
00194   assert(okltest_c_p(buildq([f],lambda([C],f({C}))))),
00195   true)$
00196 
00197 okltest_ocs_p(f) := block([x],
00198   assert(f(0) = false),
00199   assert(f({}) = false),
00200   assert(f([]) = true),
00201   assert(f([{}]) = true),
00202   assert(f([0]) = false),
00203   assert(f([{1,-1}]) = false),
00204   assert(f([{1},{-1},{2},{-2}]) = true),
00205   assert(f([{1},{1}]) = false),
00206   assert(f([{1},{1,2}]) = true),
00207   assert(okltest_c_p(buildq([f],lambda([C],f([C]))))),
00208   true)$
00209 
00210 okltest_cl_p(f) := block([x],
00211   assert(f(0) = false),
00212   assert(f({}) = false),
00213   assert(f([]) = true),
00214   assert(f([{}]) = true),
00215   assert(f([0]) = false),
00216   assert(f([{1,-1}]) = false),
00217   assert(f([{1},{-1},{2},{-2}]) = true),
00218   assert(f([{1},{1}]) = true),
00219   assert(f([{1},{1,2}]) = true),
00220   assert(okltest_c_p(buildq([f],lambda([C],f([C]))))),
00221   true)$
00222 
00223 okltest_fcs_p(f) := block([x],
00224   assert(f([{},{}]) = true),
00225   assert(f([{},{{}}]) = true),
00226   assert(f(x) = false),
00227   assert(f({}) = false),
00228   assert(f([]) = false),
00229   assert(f([{}]) = false),
00230   assert(f([{1},{}]) = true),
00231   assert(f([{-1},{}]) = false),
00232   assert(f([{},{{1}}]) = false),
00233   assert(f([{x},{}]) = false),
00234   assert(f([{x},{{x}}]) = false),
00235   assert(f([{1},{{1},{-1}}]) = true),
00236   assert(f([{1},{{1,-1}}]) = false),
00237   assert(f([{1},{{1},{-1},{1,2}}]) = false),
00238   assert(okltest_v_p(buildq([f],lambda([v],f([{v},{}]))))),
00239   true)$
00240 
00241 okltest_ofcs_p(f) := block(
00242   assert(f([[],[]]) = true),
00243   assert(f([[],[{}]]) = true),
00244   assert(f(x) = false),
00245   assert(f({}) = false),
00246   assert(f([]) = false),
00247   assert(f([[]]) = false),
00248   assert(f([[1],[]]) = true),
00249   assert(f([[-1],[]]) = false),
00250   assert(f([[],[{1}]]) = false),
00251   assert(f([[x],[]]) = false),
00252   assert(f([[x],[{x}]]) = false),
00253   assert(f([[1],[{1},{-1}]]) = true),
00254   assert(f([[1],[{1,-1}]]) = false),
00255   assert(f([[1],[{1},{-1},{1,2}]]) = false),
00256   assert(f([[],[{},{}]]) = false),
00257   assert(f([[1],[{1},{1}]]) = false),
00258   assert(okltest_v_p(buildq([f],lambda([v],f([[v],[]]))))),
00259   true)$
00260 
00261 okltest_fcl_p(f) := block([x],
00262   assert(okltest_ofcs_p(buildq([f],lambda([FF],f(FF) and listnorep_p(FF[2]))))),
00263   assert(f([[],[{},{}]]) = true),
00264   assert(f([[1],[{1},{1}]]) = true),
00265   true)$
00266 
00267 okltest_var_cs(f) := (
00268   assert(f({}) = {}),
00269   assert(f({{}}) = {}),
00270   assert(f({{1}}) = {1}),
00271   assert(f({{1},{-1}}) = {1}),
00272   assert(f({{1},{-1,2},{-2,3},{3,1}}) = {1,2,3}),
00273   true)$
00274 
00275 okltest_var_cl(f) := (
00276   assert(okltest_var_cs(buildq([f],lambda([F],f(listify(F)))))),
00277   assert(f([{1},{1},{2},{-2},{},{-1}]) = {1,2}),
00278   true)$
00279 
00280 okltest_var_ocs(f) := (
00281   assert(okltest_var_cs(buildq([f],lambda([F],f(listify(F)))))),
00282   true)$
00283 
00284 okltest_var_fcs(f) := (
00285   assert(okltest_var_cs(buildq([f],lambda([F],f(cs2fcs(F)))))),
00286   assert(f([{1,2},{}]) = {1,2}),
00287   assert(f([{1,2,3}, {{}}]) = {1,2,3}),
00288   true)$
00289 
00290 okltest_var_fcl(f) := (
00291   assert(okltest_var_fcs(buildq([f],lambda([FF],f(fcs2ofcs(FF)))))),
00292   assert(f([[1,3,2],[{}]]) = {1,2,3}),
00293   true)$
00294 
00295 okltest_var_ofcs(f) := (
00296   assert(okltest_var_fcs(buildq([f],lambda([FF],f(fcs2ofcs(FF)))))),
00297   true)$
00298 
00299 okltest_ovar_cl(f) := (
00300   assert(f([]) = []),
00301   assert(f([{}]) = []),
00302   assert(f([{},{}]) = []),
00303   assert(f([{1},{-1}]) = [1]),
00304   assert(f([{},{-1},{},{}]) = [1]),
00305   assert(f([{-2,1},{-3,2},{1,3}]) = [1,2,3]),
00306   assert(f([{-2,3},{3,-4},{-1,2,3},{}]) = [2,3,4,1]),
00307   assert(f([{4,3},{3,2},{-2,-1}]) = [3,4,2,1]),
00308   true)$
00309 
00310 okltest_olit_cs(f) := (
00311   assert(f({}) = {}),
00312   assert(f({{}}) = {}),
00313   assert(f({{1},{2},{-2}}) = {1,2,-2}),
00314   true)$
00315 
00316 okltest_flit_cs(f) := (
00317   assert(f({}) = {}),
00318   assert(f({{}}) = {}),
00319   assert(f({{1},{2},{-2}}) = {1,-1,2,-2}),
00320   true)$
00321 
00322 okltest_cs2fcs(f) := (
00323   assert(f({}) = [{},{}]),
00324   assert(f({{}}) = [{},{{}}]),
00325   assert(f({{1}}) = [{1},{{1}}]),
00326   assert(f({{2,4},{-3,-1}}) = [{1,2,3,4},{{2,4},{-3,-1}}]),
00327   true)$
00328 
00329 okltest_cl2fcl(f) := (
00330   assert(f([]) = [[],[]]),
00331   assert(f([{}]) = [[],[{}]]),
00332   assert(f([{3,4},{-1,-2}]) = [[1,2,3,4],[{3,4},{-1,-2}]]),
00333   true)$
00334 
00335 okltest_ocs2ofcs(f) := (
00336   assert(f([]) = [[],[]]),
00337   assert(f([{}]) = [[],[{}]]),
00338   assert(f([{3,4},{-1,-2}]) = [[3,4,1,2],[{3,4},{-1,-2}]]),
00339   assert(okltest_cl2fcl(buildq([f],lambda([FF],block([T:f(FF)],[sort(T[1]),T[2]]))))),
00340   true)$
00341 
00342 okltest_cs2ocs(f) := (
00343   assert(f({}) = []),
00344   assert(f({{}}) = [{}]),
00345   assert(f({{1,2},{-3,4}}) = [{-3,4},{1,2}]),
00346   true)$
00347 
00348 okltest_fcs2ofcs(f) := (
00349   assert(f([{},{}]) = [[],[]]),
00350   assert(f([{},{{}}]) = [[],[{}]]),
00351   assert(f([{1},{}]) = [[1],[]]),
00352   assert(f([{1,3},{{}}]) = [[1,3],[{}]]),
00353   assert(f([{1,2,3},{{1,2},{-3},{-1,-2}}]) = [[1,2,3],[{-3},{-1,-2},{1,2}]]),
00354   true)$
00355 
00356 okltest_fcs2fcl(f) := (
00357   assert(okltest_fcs2ofcs(f)),
00358   true)$
00359 
00360 okltest_cs2fcl(f):= (
00361   assert(f({}) = [[],[]]),
00362   assert(f({{}}) = [[],[{}]]),
00363   assert(f({{5},{-5},{2},{2,3}}) = [[2,3,5],[{-5},{2},{2,3},{5}]]),
00364   true)$
00365 
00366 okltest_ocs2cs(f) := (
00367   assert(f([]) = {}),
00368   assert(f([{}]) = {{}}),
00369   assert(f([{},{1},{-1}]) = {{},{1},{-1}}),
00370   true)$
00371 
00372 okltest_cl2cs(f) := (
00373   assert(f([]) = {}),
00374   assert(f([{}]) = {{}}),
00375   assert(f([{},{},{1},{-1}]) = {{},{1},{-1}}),
00376   assert(okltest_ocs2cs(f)),
00377   true)$
00378 
00379 okltest_fcs2cs(f) := (
00380   assert(f([{},{}]) = {}),
00381   assert(f([{},{{}}]) = {{}}),
00382   assert(f([{3,1,2},{{3},{-1},{-3},{1},{-1,-2,-3}}]) = {{3},{-1},{-3},{1},{-1,-2,-3}}),
00383   true)$
00384 
00385 okltest_ofcs2ocs(f) := (
00386   assert(f([[],[]]) = []),
00387   assert(f([[],[{}]]) = [{}]),
00388   assert(f([[3,1],[{3},{-1},{-3},{1}]]) = [{3},{-1},{-3},{1}]),
00389   assert(okltest_fcs2cs(buildq([f],lambda([FF],cl2cs(f(fcs2fcl(FF))))))),
00390   true)$
00391 
00392 okltest_fcl2cl(f) := (
00393   assert(f([[],[]]) = []),
00394   assert(f([[],[{}]]) = [{}]),
00395   assert(f([[3,1],[{3},{-1},{3},{1}]]) = [{3},{-1},{3},{1}]),
00396   assert(okltest_fcs2cs(f)),
00397   true)$
00398 
00399 okltest_fcl2cs(f) := (
00400   assert(f([[],[]]) = {}),
00401   assert(f([[],[{}]]) = {{}}),
00402   assert(f([[3,1],[{3},{-1},{3},{1}]]) = {{-1},{1},{3}}),
00403   true)$
00404 
00405 
00406 /* ***********************************
00407    * Selecting parts of a clause-set *
00408    ***********************************
00409 */
00410 
00411 okltest_scs_k(f) := (
00412   assert(f({},0) = {}),
00413   assert(f({},1) = {}),
00414   assert(f({{}},0) = {{}}),
00415   assert(f({{}},1) = {}),
00416   assert(f({{1}},0) = {}),
00417   assert(f({{1}},1) = {{1}}),
00418   true)$
00419 
00420 okltest_scs_l(f) := (
00421   assert(f({},1) = {}),
00422   assert(f({{}},1) = {}),
00423   assert(f({{1}},1) = {{1}}),
00424   assert(f({{1}},-1) = {}),
00425   assert(f({{1}},2) = {}),
00426   assert(f({{1,2},{-1,2}},1) = {{1,2}}),
00427   assert(f({{1,2},{-1,2}},-1) = {{-1,2}}),
00428   assert(f({{1,2},{-1,2}},2) = {{1,2},{-1,2}}),
00429   true)$
00430 
00431 okltest_scs_v(f) := (
00432   assert(f({},1) = {}),
00433   assert(f({{}},1) = {}),
00434   assert(f({{1}},1) = {{1}}),
00435   assert(f({{1}},-1) = {}),
00436   assert(f({{1}},2) = {}),
00437   assert(f({{1,2},{-1,2}},1) = {{1,2},{-1,2}}),
00438   assert(f({{1,2},{-1,2}},2) = {{1,2},{-1,2}}),
00439   assert(f({{1,2},{-1,2}},3) = {}),
00440   true)$
00441 
00442 okltest_scs_V(f) := block([F],
00443   assert(f({},{}) = {}),
00444   assert(f({{}},{}) = {}),
00445   assert(f({},{1}) = {}),
00446   assert(f({{1}},{}) = {}),
00447   okltest_scls_v(buildq([f],lambda([F,v],f(F,{v})))),
00448   F : {{1,2},{-1,3},{2,3},{3,4},{-2,-4}},
00449   assert(f(F,{1,2}) = {{1,2},{-1,3},{2,3},{-2,-4}}),
00450   assert(f(F,{1,4}) = {{1,2},{-1,3},{3,4},{-2,-4}}),
00451   true)$
00452 
00453 /* **************************
00454    * Crossing out variables *
00455    **************************
00456 */
00457 
00458 okltest_apply_sv_c(f) := (
00459   assert(f({},{}) = {}),
00460   assert(f({},{1,-2}) = {1,-2}),
00461   assert(f({1},{}) = {}),
00462   assert(f({1},{1,-2}) = {-2}),
00463   assert(f({1,2},{1,-2}) = {}),
00464   true)$
00465 
00466 okltest_apply_sv_cs(f) := (
00467   assert(f({},{}) = {}),
00468   assert(f({},{{}}) = {{}}),
00469   assert(f({1},{}) = {}),
00470   assert(f({1},{{}}) = {{}}),
00471   assert(f({1,2},{{1},{-1,2},{-2,3},{3,4}}) = {{},{3},{3,4}}),
00472   assert(okltest_apply_sv_c(buildq([f],lambda([V,C],single_element(f(V,{C})))))),
00473   true)$
00474 
00475 okltest_apply_sv_cl(f) := (
00476   assert(f({},[]) = []),
00477   assert(okltest_apply_sv_cs(buildq([f],lambda([V,F],cl2cs(f(V,cs2cl(F))))))),
00478   true)$
00479 
00480 okltest_apply_sv_ip_cl(f) := block([F],
00481   F : [], assert(f({},'F) = true), assert(F = []),
00482   F : [{1}], assert(f({1},'F) = true), assert(F = [{}]),
00483   assert(okltest_apply_sv_cl(buildq([f],lambda([V,F],
00484     f(V,'F), return(F))))),
00485   true)$
00486 
00487 okltest_restrict_V_cs(f) := (
00488   assert(f({},{}) = {}),
00489   assert(f({{}},{}) = {}),
00490   assert(f({{1,2},{-1,-2},{}},{1}) = {{1},{-1}}),
00491   assert(f({{1,2},{-1,-2},{}},{1,2}) = {{1,2},{-1,-2}}),
00492   true)$
00493 
00494 okltest_restrict_V_cl(f) := (
00495   assert(f([],{}) = []),
00496   assert(f([{}],{}) = []),
00497   assert(f([{1,2},{-1,-2},{},{1,2}],{1}) = [{1},{-1},{1}]),
00498   assert(f([{1,2},{-1,-2},{},{-2,3},{-3}],{1,2}) = [{1,2},{-1,-2},{-2}]),
00499   assert(okltest_restrict_V_cs(buildq([f],lambda([F,V],cl2cs(f(cs2cl(F),V)))))),
00500   true)$
00501 
00502 
00503 /* *****************************************
00504    * Printing clause-sets in Dimacs-format *
00505    *****************************************
00506 */
00507 
00508 okltest_dimacs_l_string(f) := (
00509   /* XXX */
00510   true)$
00511 
00512 okltest_dimacs_c_string(f) := (
00513   assert(f({}) = ""),
00514   assert(f({1}) = "1 "),
00515   assert(f({1,2,3,4}) = "1 2 3 4 "),
00516   true)$
00517 
00518 okltest_dimacs_c_stringext(f) := (
00519   assert(okltest_dimacs_c_string(
00520       buildq([f:f],lambda([a],f(a,dimacs_l_string))))),
00521   true)$
00522 
00523 okltest_print_fcs_v(f) := block([a,b],
00524   assert(sequal(print2string(f("XXX",[{},{}],[])), sconcatnl("c XXX","p cnf 0 0")) = true),
00525   assert(sequal(print2string(f("XXX",[{},{{}}],[])), sconcatnl("c XXX","p cnf 0 1","0")) = true),
00526   assert(sequal(print2string(f("",[{1,2},{{1,-2},{1,2}}],[a,b])), sconcatnl("c ", "c 1 : a", "c 2 : b", "p cnf 2 2", "-2 1 0", "1 2 0")) = true),
00527   /* XXX */
00528   true)$
00529 
00530 okltest_print_fcl_v(f) := block([a,b],
00531   assert(sequal(print2string(f("XXX",[[],[]],[])), sconcatnl("c XXX","p cnf 0 0")) = true),
00532   assert(sequal(print2string(f("XXX",[[],[{}]],[])), sconcatnl("c XXX","p cnf 0 1","0")) = true),
00533   assert(sequal(print2string(f("",[[2,1],[{2},{1,-2},{1,2}]],[a,b])), sconcatnl("c ", "c 1 : a", "c 2 : b", "p cnf 2 3","2 0", "-2 1 0", "1 2 0")) = true),
00534   /* XXX */
00535   true)$
00536 
00537 okltest_standard_statistics_fcs(f) := (
00538   /* XXX */
00539   true)$
00540 
00541 
00542 /* *****************************************
00543    * Printing clause-sets in PLA-format    *
00544    *****************************************
00545 */
00546 
00547 okltest_print_fcl2pla(f) := block(
00548   assert(
00549     sequal(print2string(f("",[[],[]])),
00550       sconcatnl(".i 0",".o 1",".type fd")) = true),
00551   assert(
00552     sequal(print2string(f("XXX",[[],[]])),
00553       sconcatnl("# XXX",".i 0",".o 1",".type fd")) = true),
00554   for i : 1 thru 5 do
00555     assert(
00556       sequal(print2string(f("",[create_list(j,j,1,i),[]])),
00557         sconcatnl(sconcat(".i ",i),".o 1",".type fd")) = true),
00558   assert(
00559     sequal(print2string(f("XXX",[[1],[{}]])),
00560       sconcatnl("# XXX",".i 1",".o 1",".type fd","- 1")) = true),
00561   assert(
00562     sequal(print2string(f("XXX",[[1],[{1}]])),
00563       sconcatnl("# XXX",".i 1",".o 1",".type fd","1 1")) = true),
00564   assert(
00565     sequal(print2string(f("XXX",[[1],[{-1}]])),
00566       sconcatnl("# XXX",".i 1",".o 1",".type fd","0 1")) = true),
00567   assert(
00568     sequal(print2string(f("XXX",[[1,2],[{-1},{2}]])),
00569       sconcatnl("# XXX",".i 2",".o 1",".type fd","0- 1","-1 1")) = true),
00570   assert(
00571     sequal(print2string(f("XXX",[[1,2],[{-1,2},{2}]])),
00572       sconcatnl("# XXX",".i 2",".o 1",".type fd","01 1","-1 1")) = true),
00573   assert(
00574     sequal(print2string(f("XXX",[[1,2],[{-1,2},{1,2}]])),
00575       sconcatnl("# XXX",".i 2",".o 1",".type fd","01 1","11 1")) = true),
00576   assert(
00577     sequal(print2string(f("XXX",[[1,2,3],[{-1,2},{1,2},{1,-3}]])),
00578       sconcatnl("# XXX",".i 3",".o 1",
00579                 ".type fd","01- 1","11- 1","1-0 1")) = true),
00580   true)$
00581 
00582