计算复杂度:P、NP 与布尔可满足性问题
1. 2 - 可满足性问题的公式简化
在解决 2 - 可满足性问题时,公式简化是一个关键步骤。 simplify-formula 函数用于简化公式,它接受一个公式和一个单例作为输入,并返回一个简化后的公式。
;; formula singleton →formula
;; Purpose: Simplify the given formula by removing the given singleton
;; Assumption: The given formula does not have the complement of the given
;; singleton as a clause and the given singleton’s variable is
;; assigned a value that makes the singleton true
(define (simplify-formula a-formula a-clause)
(define (simplify a-formula)
(cond [(empty? a-formula)
'()]
[(equal? (first a-formula) a-clause)
(simplify-formula (rest a-formula) a-clause)]
[(not (2disjunction? (first a-formula)))
(cons (first
超级会员免费看
订阅专栏 解锁全文
14

被折叠的 条评论
为什么被折叠?



