50、计算复杂度:P、NP 与布尔可满足性问题

计算复杂度: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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值