38 lines
1.1 KiB
Racket
38 lines
1.1 KiB
Racket
#lang typed/racket
|
|
|
|
(require "utils.rkt" typed/graph)
|
|
|
|
(provide dds%)
|
|
|
|
(define dds%
|
|
(class object%
|
|
#:forall (State Modality)
|
|
(super-new)
|
|
|
|
(: step (-> State (Listof State)))
|
|
(define/public (step st)
|
|
(map (inst cdr Modality State) (step/annotated st)))
|
|
|
|
(: step/annotated (-> State (Listof (Pairof Modality State))))
|
|
(define/abstract/error (step/annotated st))
|
|
|
|
(: step* (-> (Listof State) (Listof State)))
|
|
(define/public (step* sts)
|
|
(remove-duplicates
|
|
(apply append
|
|
(for/list : (Listof (Listof State)) ([s sts])
|
|
(step s)))))
|
|
|
|
(: build-state-graph (-> (Listof State) Graph))
|
|
(define/abstract/error (build-state-graph sts))
|
|
|
|
(: build-state-graph/annotated (-> (Listof State) Graph))
|
|
(define/abstract/error (build-state-graph/annotated sts))
|
|
|
|
(: build-state-graph* (-> (Listof State) Integer Graph))
|
|
(define/abstract/error (build-state-graph* sts nsteps))
|
|
|
|
(: build-state-graph*/annotated (-> (Listof State) Integer Graph))
|
|
(define/abstract/error (build-state-graph*/annotated nsteps sts))
|
|
))
|