#lang scheme
(require "proof.ss")
(define key 'dracula)
(define (annotate v stx)
(syntax-property stx key v))
(define (extract stx)
(syntax-property stx key))
(define (get v)
(cond
[(and (syntax? v) (extract v)) => list]
[(syntax? v) (get (syntax-e v))]
[(pair? v) (append (get (car v)) (get (cdr v)))]
[else null]))
(define (get-proof stx)
(match (filter proof? (get stx))
[(list pf) pf]
[v
(error 'get-proof
"expected (list Proof); got:\n~s\nfrom:\n~s"
v (syntax->datum stx))]))
(provide/contract
[rename annotate annotate-term (-> term? syntax? syntax?)]
[rename annotate annotate-part (-> part? syntax? syntax?)]
[rename annotate annotate-proof (-> proof? syntax? syntax?)]
[rename get get-terms (-> syntax? (listof term?))]
[rename get get-parts (-> syntax? (listof part?))]
[get-proof (-> syntax? proof?)])