:- module test_bitset.
:- use_module bool, builtin, enum, exception, int, list, maybe, pair, private_builtin, require, set, set_ordlist, solutions, string, table_builtin, tree_bitset.
:- type test_bitset.test_bitset(T) == pair.pair(tree_bitset.tree_bitset(T), set_ordlist.set_ordlist(T)).
test_bitset.init = pair.(V_2 - V_3) :-
    V_2 = tree_bitset.init,
    V_3 = set_ordlist.init.
test_bitset.singleton_set(A_3) = pair.(V_4 - V_5) :-
    V_4 = tree_bitset.make_singleton_set(A_3),
    V_5 = set_ordlist.make_singleton_set(A_3).
test_bitset.make_singleton_set(A_3) = pair.(V_4 - V_5) :-
    V_4 = tree_bitset.make_singleton_set(A_3),
    V_5 = set_ordlist.make_singleton_set(A_3).
test_bitset.init(HeadVar__1_1) :-
    HeadVar__1_1 = test_bitset.init.
test_bitset.singleton_set(HeadVar__1_1, A_3) :-
    HeadVar__1_1 = test_bitset.singleton_set(A_3).
test_bitset.make_singleton_set(HeadVar__1_1, A_3) :-
    HeadVar__1_1 = test_bitset.make_singleton_set(A_3).
test_bitset.list_to_set(A_3, HeadVar__2_2) :-
    HeadVar__2_2 = test_bitset.list_to_set(A_3).
test_bitset.sorted_list_to_set(A_3, HeadVar__2_2) :-
    HeadVar__2_2 = test_bitset.sorted_list_to_set(A_3).
test_bitset.to_sorted_list(A_3, HeadVar__2_2) :-
    HeadVar__2_2 = test_bitset.to_sorted_list(A_3).
test_bitset.set_to_bitset(Set_3) = pair.(A_4 - B_5) :-
    set.to_sorted_list(Set_3, SortedList_6),
    V_7 = pair.(A_4 - B_5) : pair.pair(tree_bitset.tree_bitset(T_1), set_ordlist.set_ordlist(T_1)),
    V_7 = test_bitset.sorted_list_to_set(SortedList_6).
test_bitset.bitset_to_set(pair.(A_3 - B_4)) = Set_5 :-
    SortedList_6 = test_bitset.to_sorted_list(V_7),
    V_7 = pair.(A_3 - B_4) : pair.pair(tree_bitset.tree_bitset(T_1), set_ordlist.set_ordlist(T_1)),
    set.sorted_list_to_set(SortedList_6, Set_5).
test_bitset.from_set(Set_3) = HeadVar__2_2 :-
    HeadVar__2_2 = test_bitset.set_to_bitset(Set_3).
test_bitset.to_set(Set_3) = HeadVar__2_2 :-
    HeadVar__2_2 = test_bitset.bitset_to_set(Set_3).
test_bitset.union(A_4, B_5, HeadVar__3_3) :-
    HeadVar__3_3 = test_bitset.union(A_4, B_5).
test_bitset.union_list(Sets_3, HeadVar__2_2) :-
    HeadVar__2_2 = test_bitset.union_list(Sets_3).
test_bitset.intersect(A_4, B_5, HeadVar__3_3) :-
    HeadVar__3_3 = test_bitset.intersect(A_4, B_5).
test_bitset.intersect_list(Sets_3, HeadVar__2_2) :-
    HeadVar__2_2 = test_bitset.intersect_list(Sets_3).
test_bitset.difference(A_4, B_5, HeadVar__3_3) :-
    HeadVar__3_3 = test_bitset.difference(A_4, B_5).
test_bitset.divide(Pred_5, pair.(SetA_6 - SetB_7), ResultIn_8, ResultOut_9) :-
    tree_bitset.divide(Pred_5, SetA_6, InSetA_10, OutSetA_11),
    set_ordlist.divide(Pred_5, SetB_7, InSetB_12, OutSetB_13),
    tree_bitset.to_sorted_list(SetA_6, SetListA_14),
    set_ordlist.to_sorted_list(SetB_7, SetListB_15),
    tree_bitset.to_sorted_list(InSetA_10, InSetListA_16),
    set_ordlist.to_sorted_list(InSetB_12, InSetListB_17),
    tree_bitset.to_sorted_list(OutSetA_11, OutSetListA_18),
    set_ordlist.to_sorted_list(OutSetB_13, OutSetListB_19),
    (if
      SetListA_14 = SetListB_15,
      InSetListA_16 = InSetListB_17,
      OutSetListA_18 = OutSetListB_19
    then
      ResultIn_8 = pair.(InSetA_10 - InSetB_12) : pair.pair(tree_bitset.tree_bitset(T_1), set_ordlist.set_ordlist(T_1)),
      ResultOut_9 = pair.(OutSetA_11 - OutSetB_13) : pair.pair(tree_bitset.tree_bitset(T_1), set_ordlist.set_ordlist(T_1))
    else
      V_20 = "test_bitset" : string,
      V_21 = "predicate `test_bitset.divide\'/4" : string,
      V_22 = "failed" : string,
      require.unexpected(V_20, V_21, V_22)
    ).
test_bitset.foldl(Pred_5, pair.(SetA_6 - SetB_7), Acc0_8, Acc_9) :-
    tree_bitset.to_sorted_list(SetA_6, SetListA_10),
    set_ordlist.to_sorted_list(SetB_7, SetListB_11),
    tree_bitset.foldl(Pred_5, SetA_6, Acc0_8, AccA_12),
    set_ordlist.fold(Pred_5, SetB_7, Acc0_8, AccB_13),
    (if
      SetListA_10 = SetListB_11,
      AccA_12 = AccB_13
    then
      Acc_9 = AccA_12
    else
      V_14 = "test_bitset" : string,
      V_15 = "predicate `test_bitset.foldl\'/4" : string,
      V_16 = "failed" : string,
      require.unexpected(V_14, V_15, V_16)
    ).
test_bitset.foldl(Pred_5, pair.(SetA_6 - SetB_7), Acc0_8) = Acc_9 :-
    tree_bitset.to_sorted_list(SetA_6, SetListA_10),
    set_ordlist.to_sorted_list(SetB_7, SetListB_11),
    AccA_12 = tree_bitset.foldl(Pred_5, SetA_6, Acc0_8),
    AccB_13 = set_ordlist.fold(Pred_5, SetB_7, Acc0_8),
    (if
      SetListA_10 = SetListB_11,
      AccA_12 = AccB_13
    then
      Acc_9 = AccA_12
    else
      V_14 = "test_bitset" : string,
      V_15 = "function `test_bitset.foldl\'/3" : string,
      V_16 = "failed" : string,
      require.unexpected(V_14, V_15, V_16)
    ).
test_bitset.all_true(Pred_3, pair.(SetA_4 - SetB_5)) :-
    (if
      tree_bitset.all_true(Pred_3, SetA_4)
    then
      (if
        set_ordlist.all_true(Pred_3, SetB_5)
      then
        true
      else
        V_6 = "test_bitset" : string,
        V_7 = "predicate `test_bitset.all_true\'/2" : string,
        V_8 = "tree_bitset but not set_ordlist" : string,
        require.unexpected(V_6, V_7, V_8)
      )
    else
      (if
        set_ordlist.all_true(Pred_3, SetB_5)
      then
        V_9 = "test_bitset" : string,
        V_10 = "predicate `test_bitset.all_true\'/2" : string,
        V_11 = "set_ordlist but not tree_bitset" : string,
        require.unexpected(V_9, V_10, V_11)
      else
        fail
      )
    ).
test_bitset.filter(Pred_4, pair.(SetA_5 - SetB_6)) = Result_7 :-
    tree_bitset.to_sorted_list(SetA_5, SetListA_8),
    set_ordlist.to_sorted_list(SetB_6, SetListB_9),
    InSetA_10 = tree_bitset.filter(Pred_4, SetA_5),
    InSetB_11 = set_ordlist.filter(Pred_4, SetB_6),
    tree_bitset.to_sorted_list(InSetA_10, InSetListA_12),
    set_ordlist.to_sorted_list(InSetB_11, InSetListB_13),
    (if
      SetListA_8 = SetListB_9,
      InSetListA_12 = InSetListB_13
    then
      Result_7 = pair.(InSetA_10 - InSetB_11) : pair.pair(tree_bitset.tree_bitset(T_1), set_ordlist.set_ordlist(T_1))
    else
      V_14 = "test_bitset" : string,
      V_15 = "function `test_bitset.filter\'/2" : string,
      V_16 = "failed" : string,
      require.unexpected(V_14, V_15, V_16)
    ).
test_bitset.filter(Pred_5, pair.(SetA_6 - SetB_7), ResultIn_8, ResultOut_9) :-
    tree_bitset.to_sorted_list(SetA_6, SetListA_10),
    set_ordlist.to_sorted_list(SetB_7, SetListB_11),
    tree_bitset.filter(Pred_5, SetA_6, InSetA_12, OutSetA_13),
    set_ordlist.filter(Pred_5, SetB_7, InSetB_14, OutSetB_15),
    tree_bitset.to_sorted_list(InSetA_12, InSetListA_16),
    set_ordlist.to_sorted_list(InSetB_14, InSetListB_17),
    tree_bitset.to_sorted_list(OutSetA_13, OutSetListA_18),
    set_ordlist.to_sorted_list(OutSetB_15, OutSetListB_19),
    (if
      SetListA_10 = SetListB_11,
      InSetListA_16 = InSetListB_17,
      OutSetListA_18 = OutSetListB_19
    then
      ResultIn_8 = pair.(InSetA_12 - InSetB_14) : pair.pair(tree_bitset.tree_bitset(T_1), set_ordlist.set_ordlist(T_1)),
      ResultOut_9 = pair.(OutSetA_13 - OutSetB_15) : pair.pair(tree_bitset.tree_bitset(T_1), set_ordlist.set_ordlist(T_1))
    else
      V_20 = "test_bitset" : string,
      V_21 = "predicate `test_bitset.filter\'/4" : string,
      V_22 = "failed" : string,
      require.unexpected(V_20, V_21, V_22)
    ).
:- pragma exceptions(function, (test_bitset.init), 1, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.singleton_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.make_singleton_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.init), 1, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.singleton_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.make_singleton_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.count), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.is_empty), 1, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.is_non_empty), 1, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.is_singleton), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.contains), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.member), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.member), 2, 1, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.equal), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.subset), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.superset), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.list_to_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.sorted_list_to_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.to_sorted_list), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.list_to_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.sorted_list_to_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.to_sorted_list), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.set_to_bitset), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.bitset_to_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.from_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.to_set), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.insert), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.insert_new), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.insert_list), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.delete), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.delete_list), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.remove), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.remove_list), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.remove_least), 3, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.union), 3, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.union_list), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.intersect), 3, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.intersect_list), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.difference), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.union), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.union_list), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.intersect), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.intersect_list), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.difference), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.divide), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.divide_by_set), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.foldl), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.foldl), 4, 1, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.foldl), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.all_true), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (test_bitset.filter), 3, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (test_bitset.filter), 4, 0, may_throw(user_exception)).
:- pragma termination_info((test_bitset.init) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.singleton_set((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.make_singleton_set((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.init((builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.singleton_set((builtin.out), (builtin.in)), infinite, can_loop).
:- pragma termination_info(test_bitset.make_singleton_set((builtin.out), (builtin.in)), infinite, can_loop).
:- pragma termination_info(test_bitset.count((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.is_empty((builtin.in)), finite(0, [no, no]), can_loop).
:- pragma termination_info(test_bitset.is_non_empty((builtin.in)), finite(0, [no, no]), can_loop).
:- pragma termination_info(test_bitset.is_singleton((builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.contains((builtin.in), (builtin.in)), finite(0, [no, no, no]), can_loop).
:- pragma termination_info(test_bitset.member((builtin.in), (builtin.in)), finite(0, [no, no, no]), can_loop).
:- pragma termination_info(test_bitset.member((builtin.out), (builtin.in)), infinite, can_loop).
:- pragma termination_info(test_bitset.equal((builtin.in), (builtin.in)), finite(0, [no, no, no]), can_loop).
:- pragma termination_info(test_bitset.subset((builtin.in), (builtin.in)), finite(0, [no, no, no]), can_loop).
:- pragma termination_info(test_bitset.superset((builtin.in), (builtin.in)), finite(0, [no, no, no]), can_loop).
:- pragma termination_info(test_bitset.list_to_set((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.sorted_list_to_set((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.to_sorted_list((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.list_to_set((builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.sorted_list_to_set((builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.to_sorted_list((builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.set_to_bitset((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.bitset_to_set((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.from_set((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.to_set((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.insert((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.insert_new((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.insert_list((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.delete((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.delete_list((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.remove((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.remove_list((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.remove_least((builtin.out), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.union((builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.union_list((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.intersect((builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.intersect_list((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.difference((builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.union((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.union_list((builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.intersect((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.intersect_list((builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.difference((builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.divide(builtin.in((pred((builtin.in)) is semidet)), (builtin.in), (builtin.out), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.divide_by_set((builtin.in), (builtin.in), (builtin.out), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.foldl((pred((builtin.in), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.foldl((pred((builtin.in), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(test_bitset.foldl((func((builtin.in), (builtin.in)) = (builtin.out) is det), (builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.all_true(builtin.in((pred((builtin.in)) is semidet)), (builtin.in)), infinite, can_loop).
:- pragma termination_info(test_bitset.filter(builtin.in((pred((builtin.in)) is semidet)), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(test_bitset.filter(builtin.in((pred((builtin.in)) is semidet)), (builtin.in), (builtin.out), (builtin.out)), infinite, can_loop).
