From d64b04a8f007832013c8f711da91cb0630fa4e77 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sun, 15 May 2022 19:05:07 +0200 Subject: [PATCH] Type build-all-boolean-states. --- networks.rkt | 27 +++++++++++++-------------- scribblings/networks.scrbl | 9 +++++++++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/networks.rkt b/networks.rkt index 116d231..85bd924 100644 --- a/networks.rkt +++ b/networks.rkt @@ -23,7 +23,7 @@ network-form->network/01 make-boolean-network-form forms->boolean-network - build-all-states + build-all-states build-all-boolean-states list-syntactic-interactions build-syntactic-interaction-graph ) @@ -263,6 +263,18 @@ #hash((a . #f) (b . 2)) #hash((a . #f) (b . 3)))))) + (: build-all-boolean-states (-> (Listof Variable) (Listof (State Boolean)))) + (define (build-all-boolean-states vars) + (build-all-states (make-boolean-domains vars))) + + (module+ test + (test-case "build-all-boolean-states" + (check-equal? (build-all-boolean-states '(a b)) + '(#hash((a . #f) (b . #f)) + #hash((a . #f) (b . #t)) + #hash((a . #t) (b . #f)) + #hash((a . #t) (b . #t)))))) + (: list-syntactic-interactions (All (a) (-> (NetworkForm a) Variable (Listof Variable)))) (define (list-syntactic-interactions nf x) @@ -319,7 +331,6 @@ [build-interaction-graph/form (-> network-form? graph?)] [build-signed-interaction-graph (-> network? graph?)] [build-signed-interaction-graph/form (-> network-form? graph?)] - [build-all-boolean-states (-> (listof variable?) (listof state?))] [build-all-01-states (-> (listof variable?) (listof state?))] [make-asyn (-> (listof variable?) mode?)] [make-syn (-> (listof variable?) mode?)] @@ -461,18 +472,6 @@ ;;; Inferring interaction graphs ;;; ============================ -;;; Builds all boolean states possible over a given set of variables. -(define (build-all-boolean-states vars) - (build-all-states (make-boolean-domains vars))) - -(module+ test - (test-case "build-all-boolean-states" - (check-equal? (build-all-boolean-states '(a b)) - '(#hash((a . #f) (b . #f)) - #hash((a . #f) (b . #t)) - #hash((a . #t) (b . #f)) - #hash((a . #t) (b . #t)))))) - ;;; Builds all Boolean states over a given set of variables, but with ;;; 0 and 1 for Boolean values. (define build-all-01-states diff --git a/scribblings/networks.scrbl b/scribblings/networks.scrbl index 0908cd4..985d7f4 100644 --- a/scribblings/networks.scrbl +++ b/scribblings/networks.scrbl @@ -344,6 +344,15 @@ Given a @racket[DomainMapping], constructs the list of all possible states. (build-all-states (make-boolean-domains '(a b))) ]} +@defproc[(build-all-boolean-states [vars (Listof Variable)]) + (Listof (State Boolean))]{ + +Builds all Boolean states over a given list of variables. + +@ex[ +(build-all-boolean-states '(a b)) +]} + @section{Inferring interaction graphs} This section provides inference of both unsigned and signed interaction graphs.