简化布尔表达式

时间:2016-09-16 00:54:18

标签: logical-operators boolean-logic boolean-expression

我有一个f(a,b,c,d) = b*(a+~c) + d*(a+~b)函数,其中*(AND)+(OR)~(NOT)

使用分配法,我得到:ba + b~c + da + d~b

但答案是ab + b~c + d~b

我无法弄清楚如何摆脱da

我尝试将a取出来获得:a(b+d) + b~c + d~b,但这并不能让我在任何地方。

2 个答案:

答案 0 :(得分:1)

您可以创建一个包含每个参数的所有可能值的表:[1,0]并计算两个表达式。如果您可以在每个案例中表明他们评估的结果相同,那么您就会表明它们是等效的,因此ad可以被删除。

我将演示并让你完成练习:

enter image description here

答案 1 :(得分:1)

所以问题是为什么 ... debianPackageDependencies in Debian ++= Seq("postgresql-9.5 (>= 9.5.1)") lazy val root = (project in file(".")).enablePlugins(PlayScala, JavaAgent) scalaVersion := "2.11.8" val akkaVersion = "2.4.10" libraryDependencies ++= Seq( "org.postgresql" % "postgresql" % "9.4.1208", "org.scalikejdbc" %% "scalikejdbc" % "2.4.0", "org.scalikejdbc" %% "scalikejdbc-config" % "2.4.0", "org.scalikejdbc" %% "scalikejdbc-play-initializer" % "2.5.1", "org.flywaydb" %% "flyway-play" % "3.0.1", "com.typesafe.akka" %% "akka-contrib" % akkaVersion, "com.typesafe.akka" %% "akka-slf4j" % akkaVersion, "io.dropwizard.metrics" % "metrics-core" % "3.1.2", "io.dropwizard.metrics" % "metrics-jvm" % "3.1.2", "org.coursera" % "dropwizard-metrics-datadog" % "1.1.4", "com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test, "com.relayrides" % "pushy" % "0.8", "com.relayrides" % "pushy-dropwizard-metrics-listener" % "0.8", "org.eclipse.jetty.alpn" % "alpn-api" % "1.1.3.v20160715" % "runtime", ws, specs2 % Test ) resolvers += "Typesafe Releases" at "http://repo.typesafe.com/typesafe/maven-releases/" resolvers += Resolver.mavenLocal routesGenerator := InjectedRoutesGenerator javaOptions in Test ++= Seq("-Dlogger.resource=logback-test.xml") scalacOptions in Universal ++= Seq("-unchecked", "-deprecation", "-notailcalls") javaOptions in Universal ++= Seq( "-J-server", ... ) ... import com.typesafe.sbt.packager.archetypes.systemloader._ // UpstartPlugin for ubuntu 14.04, SystemdPlugin for ubuntu 16.04 enablePlugins(JavaServerAppPackaging, JDebPackaging, SystemdPlugin, UpstartPlugin) requiredStartFacilities := Some("datadog-agent.service, systemd-journald.service, postgresql.service") javaAgents += "org.mortbay.jetty.alpn" % "jetty-alpn-agent" % "2.0.4" % "dist"

原因很简单, ba + b~c + da + d~b = ab + b~c + d~b不会在左侧添加任何内容

如果有,会出现 da da = true 的情况。但是,如果 ab + b~c + d~b = false ,则 da = true d = true 。如果 a = true b ,那么 true ,我们在右侧没有添加任何内容。如果 ab = true ,则 b = false ,我们也没有添加任何内容。

可以使用表格或转换规则,例如分布等。但是,最好还是尝试理解为什么两个表达式是等价的。