Move make-same-domains, make-boolean-domains, and make-01-domains to Utilities.

This commit is contained in:
Sergiu Ivanov 2022-05-01 01:07:33 +02:00
parent 458ba10ab5
commit fc633c2e4c
1 changed files with 29 additions and 29 deletions

View File

@ -108,6 +108,35 @@ Converts the values 0 and 1 in a state to @racket[#f] and
(01->boolean/state (hash 'a 0 'b 1))
]}
@defproc[(make-same-domains [vars (Listof Variable)]
[domain (Domain a)])
(DomainMapping a)]{
Makes a hash set mapping all variables to a single domain.
@ex[
(make-same-domains '(a b) '(1 2))
]}
@defproc[(make-boolean-domains [vars (Listof Variable)])
(DomainMapping Boolean)]{
Makes a hash set mapping all variables to the Boolean domain.
@ex[
(make-boolean-domains '(a b))
]}
@defproc[(make-01-domains [vars (Listof Variable)])
(DomainMapping (U Zero One))]{
Makes a hash set mapping all variables to the Boolean domain, expressed as
@tt{{0,1}}.
@ex[
(make-01-domains '(a b))
]}
@section{Networks}
@defstruct*[network ([functions (VariableMapping (UpdateFunction a))]
@ -131,25 +160,6 @@ The type of the instances of @racket[Network].
'b '(#f #t)))
]}
@defproc[(make-same-domains [vars (Listof Variable)]
[domain (Domain a)])
(DomainMapping a)]{
Makes a hash set mapping all variables to a single domain.
@ex[
(make-same-domains '(a b) '(1 2))
]}
@defproc[(make-boolean-domains [vars (Listof Variable)])
(DomainMapping Boolean)]{
Makes a hash set mapping all variables to the Boolean domain.
@ex[
(make-boolean-domains '(a b))
]}
@defproc[(make-boolean-network [funcs (VariableMapping (UpdateFunction Boolean))])
(Network Boolean)]{
@ -160,16 +170,6 @@ variables by attributing Boolean domains to every variable.
(make-boolean-network (hash 'a or-func 'b and-func))
]}
@defproc[(make-01-domains [vars (Listof Variable)])
(DomainMapping (U Zero One))]{
Makes a hash set mapping all variables to the Boolean domain, expressed as
@tt{{0,1}}.
@ex[
(make-01-domains '(a b))
]}
@defproc[(make-01-network [funcs (VariableMapping (UpdateFunction (U Zero One)))])
(Network (U Zero One))]{