Type build-all-boolean-states.

This commit is contained in:
Sergiu Ivanov 2022-05-15 19:05:07 +02:00
parent eaabcd9a05
commit d64b04a8f0
2 changed files with 22 additions and 14 deletions

View file

@ -23,7 +23,7 @@
network-form->network/01 make-boolean-network-form network-form->network/01 make-boolean-network-form
forms->boolean-network forms->boolean-network
build-all-states build-all-states build-all-boolean-states
list-syntactic-interactions build-syntactic-interaction-graph list-syntactic-interactions build-syntactic-interaction-graph
) )
@ -263,6 +263,18 @@
#hash((a . #f) (b . 2)) #hash((a . #f) (b . 2))
#hash((a . #f) (b . 3)))))) #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 (: list-syntactic-interactions
(All (a) (-> (NetworkForm a) Variable (Listof Variable)))) (All (a) (-> (NetworkForm a) Variable (Listof Variable))))
(define (list-syntactic-interactions nf x) (define (list-syntactic-interactions nf x)
@ -319,7 +331,6 @@
[build-interaction-graph/form (-> network-form? graph?)] [build-interaction-graph/form (-> network-form? graph?)]
[build-signed-interaction-graph (-> network? graph?)] [build-signed-interaction-graph (-> network? graph?)]
[build-signed-interaction-graph/form (-> network-form? 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?))] [build-all-01-states (-> (listof variable?) (listof state?))]
[make-asyn (-> (listof variable?) mode?)] [make-asyn (-> (listof variable?) mode?)]
[make-syn (-> (listof variable?) mode?)] [make-syn (-> (listof variable?) mode?)]
@ -461,18 +472,6 @@
;;; Inferring interaction graphs ;;; 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 ;;; Builds all Boolean states over a given set of variables, but with
;;; 0 and 1 for Boolean values. ;;; 0 and 1 for Boolean values.
(define build-all-01-states (define build-all-01-states

View file

@ -344,6 +344,15 @@ Given a @racket[DomainMapping], constructs the list of all possible states.
(build-all-states (make-boolean-domains '(a b))) (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} @section{Inferring interaction graphs}
This section provides inference of both unsigned and signed interaction graphs. This section provides inference of both unsigned and signed interaction graphs.