(define impc:ti:variable-substitution-pairs
(lambda (t1 t2)
(if (or (not (list? t1))
(not (list? t2))
(<> (length t1) (length t2)))
'()
(let ((pairs
(flatten (map (lambda (a b)
(cond ((list? a)
(impc:ti:variable-substitution-pairs a b))
((atom? a)
(if (and (impc:ir:type? a)
(symbol? b)
(regex:match? (symbol->string b) "^!"))
(cons (symbol->string b) (impc:ir:pretty-print-type a))))
(else '())))
t1 t2))))
pairs))))