Type make-boolean-network-form.

This commit is contained in:
Sergiu Ivanov 2022-05-05 11:25:10 +02:00
parent 7a3cbaa1af
commit 871a923842
2 changed files with 25 additions and 16 deletions

View File

@ -20,7 +20,7 @@
update-function-form->update-function/boolean
update-function-form->update-function/01
network-form->network/any network-form->network/boolean
network-form->network/01
network-form->network/01 make-boolean-network-form
)
(define-type (State a) (VariableMapping a))
@ -212,6 +212,19 @@
'b '(0 1)))))
(define s (hash 'a 1 'b 1))
(check-equal? ((hash-ref (network-functions bn) 'a) s) 1)))
(: make-boolean-network-form (-> (VariableMapping UpdateFunctionForm)
(NetworkForm Boolean)))
(define (make-boolean-network-form forms)
(network-form forms (make-boolean-domains (hash-keys forms))))
(module+ test
(test-case "make-boolean-network-form"
(check-equal? (make-boolean-network-form (hash 'a '(and a b)
'b '(not b)))
(network-form
'#hash((a . (and a b)) (b . (not b)))
'#hash((a . (#f #t)) (b . (#f #t)))))))
)
(require 'typed)
@ -228,8 +241,7 @@
[struct dynamics ([network network?]
[mode mode?])])
;; Functions
(contract-out [make-boolean-network-form (-> variable-mapping? network-form?)]
[forms->boolean-network (-> variable-mapping? network?)]
(contract-out [forms->boolean-network (-> variable-mapping? network?)]
[list-syntactic-interactions (-> network-form? variable? (listof variable?))]
[build-syntactic-interaction-graph (-> network-form? graph?)]
[interaction? (-> network? variable? variable? boolean?)]
@ -376,19 +388,6 @@
(define update-function-form? any/c)
;;; Build a Boolean network form from a given mapping assigning forms
;;; to variables.
(define (make-boolean-network-form forms)
(network-form forms (make-boolean-domains (hash-keys forms))))
(module+ test
(test-case "make-boolean-network-form"
(check-equal? (make-boolean-network-form (hash 'a '(and a b)
'b '(not b)))
(network-form
'#hash((a . (and a b)) (b . (not b)))
'#hash((a . (#f #t)) (b . (#f #t)))))))
;;; Build a Boolean network from a given mapping assigning forms
;;; to variables.
(define forms->boolean-network

View File

@ -310,6 +310,16 @@ domains are expressed as @tt{{0,1}}.
'b '(0 1))))
]}
@defproc[(make-boolean-network-form [forms (VariableMapping UpdateFunctionForm)])
(NetworkForm Boolean)]{
Build a Boolean network form from a given mapping assigning forms to variables.
@ex[
(make-boolean-network-form (hash 'a '(and a b)
'b '(not b)))
]}
@section{Inferring interaction graphs}
This section provides inference of both unsigned and signed interaction graphs.