Type build-all-01-states.

This commit is contained in:
Sergiu Ivanov 2022-05-15 19:52:37 +02:00
parent d64b04a8f0
commit 1bfc44491e
2 changed files with 22 additions and 15 deletions

View file

@ -23,7 +23,7 @@
network-form->network/01 make-boolean-network-form
forms->boolean-network
build-all-states build-all-boolean-states
build-all-states build-all-boolean-states build-all-01-states
list-syntactic-interactions build-syntactic-interaction-graph
)
@ -275,6 +275,18 @@
#hash((a . #t) (b . #f))
#hash((a . #t) (b . #t))))))
(: build-all-01-states (-> (Listof Variable) (Listof (State (U Zero One)))))
(define (build-all-01-states vars)
(build-all-states (make-01-domains vars)))
(module+ test
(test-case "build-all-01-states"
(check-equal? (build-all-01-states '(a b))
'(#hash((a . 0) (b . 0))
#hash((a . 0) (b . 1))
#hash((a . 1) (b . 0))
#hash((a . 1) (b . 1))))))
(: list-syntactic-interactions
(All (a) (-> (NetworkForm a) Variable (Listof Variable))))
(define (list-syntactic-interactions nf x)
@ -331,7 +343,6 @@
[build-interaction-graph/form (-> network-form? graph?)]
[build-signed-interaction-graph (-> network? graph?)]
[build-signed-interaction-graph/form (-> network-form? graph?)]
[build-all-01-states (-> (listof variable?) (listof state?))]
[make-asyn (-> (listof variable?) mode?)]
[make-syn (-> (listof variable?) mode?)]
[make-dynamics-from-func (-> network? (-> (listof variable?) mode?) dynamics?)]
@ -472,19 +483,6 @@
;;; Inferring interaction graphs
;;; ============================
;;; Builds all Boolean states over a given set of variables, but with
;;; 0 and 1 for Boolean values.
(define build-all-01-states
(compose build-all-states make-01-domains))
(module+ test
(test-case "build-all-01-states"
(check-equal? (build-all-01-states '(a b))
'(#hash((a . 0) (b . 0))
#hash((a . 0) (b . 1))
#hash((a . 1) (b . 0))
#hash((a . 1) (b . 1))))))
;;; Given two variables x and y of a network f, verifies if they
;;; interact, i.e. that there exists such a state s with the property
;;; that s' which is s with a different value for x yields such a new

View file

@ -353,6 +353,15 @@ Builds all Boolean states over a given list of variables.
(build-all-boolean-states '(a b))
]}
@defproc[(build-all-01-states [vars (Listof Variable)])
(Listof (State Boolean))]{
Builds all Boolean states over a given set of variables, but with the Boolean
values represented as 0 and 1.
@ex[
(build-all-01-states '(a b))
]}
@section{Inferring interaction graphs}
This section provides inference of both unsigned and signed interaction graphs.