diff --git a/networks.rkt b/networks.rkt index fde16b8..0fc6f5a 100644 --- a/networks.rkt +++ b/networks.rkt @@ -100,7 +100,8 @@ [update-function-form? (-> any/c boolean?)] [network-form? (-> any/c boolean?)] [modality? (-> any/c boolean?)] - [mode? (-> any/c boolean?)]) + [mode? (-> any/c boolean?)] + [sbf/state? (-> any/c boolean?)]) ;; Contracts (contract-out [state/c contract?] [update-function/c contract?] @@ -959,6 +960,13 @@ ;;; applied to states in an unambiguous ways. (struct tbf/state (weights threshold) #:transparent) +;;; A sign Boolean function (SBF) is a TBF whose threshold is 0. +(define sbf/state? (and/c tbf/state? (λ (tbf) (zero? (tbf/state-θ tbf))))) + +(module+ test + (test-case "sbf/state?" + (check-true (sbf/state? (tbf/state #hash((a . -1) (b . 1)) 0))))) + ;;; Shortcuts for acessing fields of a state/tbf. (define tbf/state-w tbf/state-weights) (define tbf/state-θ tbf/state-threshold)