sf <-> tt logic seems done

This commit is contained in:
Peter Harpending 2025-10-11 06:55:16 -06:00
parent 7560ee9151
commit 25bcfda65c
2 changed files with 18 additions and 1 deletions

View File

@ -7,6 +7,8 @@
]).
-export([
ttfun_to_tt/1,
ttfun_to_sf/1,
arity/1,
tt/1, sf/1,
sf_to_tt/1, tt_to_sf/1,
@ -19,6 +21,21 @@
-opaque sf() :: {sf, wfc_bm:bm()}.
-opaque tt() :: {tt, wfc_bm:bm()}.
-spec ttfun_to_tt(fun()) -> tt().
ttfun_to_tt(Fun) ->
{arity, Arity} = erlang:fun_info(Fun, arity),
Argses = bfls(Arity),
OutputCol = [erlang:apply(Fun, Args) || Args <- Argses],
{tt, wfc_bm:col(OutputCol)}.
-spec ttfun_to_sf(fun()) -> sf().
ttfun_to_sf(Fun) ->
tt_to_sf(ttfun_to_tt(Fun)).
-spec arity(sf() | tt()) -> pos_integer().
arity({sf, BM}) -> matrix_arity(BM);

View File

@ -1,6 +1,6 @@
% @doc
% library of truth tables
-module(wfc_tts).
-module(wfc_ttfuns).
-export_type([
bit/0,