logic – Simplifying SOPs: Implementing OR with NAND

I'm learning to implement basic logic gates with the help of NAND. I've learned that you can use De Morgan's theorem as such:

$ a + b = bar { bar a} + bar { bar b} = overline {( bar a * bar b)} ​​$

In other words, we would need two NOT gates (which are essentially NAND gates) and another NAND gate.

However, I want to practice the simplification of Boolean algebra. Using a truth table, I have formed the sum of products:

$ f (a, b) = ab + + a & # 39; b + ab $

I have mapped out several paths without success. I would appreciate that someone can point out the simplification steps or give me guidance on the laws to use to achieve this simplification. If there are any log errors I made, thank you for letting me know 🙂

When is this statement true? Never treated equations like these in logic before.

Thank you for your contribution to Mathematics Stack Exchange!

  • Please make sure to respond to the question. Provide details and share your research!

But to avoid

  • Ask for help, clarification, or answer other answers.
  • Make statements based on opinions; save them with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, read our tips for writing good answers.

c # – Encapsulation of authorization logic, while avoiding circular dependencies

I'm trying to encapsulate the permissions logic for a particular view model so that permissions logic has access to the view template object, but is also exposed to the view. inside of it.

Trivial implementation:

Public class ClientViewModel
{
public Client Client {get; together; }

/ * permissions section * /
public bool CanVote => Client.Age> 18
public bool CanDrink => Client.Age> 21
}

The implementation is quite clean and simple. The view will have to make many decisions based on the set of properties available in the permissions. But since there will be a lot of permissions, I would ideally like this logic to be contained elsewhere.

At the moment, I can access like this:

var vm = new ClientViewModel () {Client = myClient};
vm.CanVote

But J & # 39; would contain all the logic within the same class and access like this:

vm.Permissions.CanVote

Circular implementation

I can therefore put a property of type ClientViewModelPermissions on the ViewModel itself. It must have access to the data objects on the ViewModel that it describes so that I can pass the instance of the model in the Permissions constructor and create it during model construction, like this:

Public class ClientViewModel
{
public ClientViewModel ()
{
// create an instance of permissions for the current object
Permissions = new ClientViewModelPermissions (this);
}

public Client Client {get; together; }

public permissions ClientViewModelPermissions {get; together; }
}

Public class ClientViewModelPermissions
{
public ClientViewModelPermissions (ClientViewModel clientVm)
{
// permissions must describe a particular view template
ClientModel = clientVm;
}

private ClientViewModel ClientModel {get; together; }

public bool CanVote => ClientModel.Client.Age> 18
public bool CanDrink => ClientModel.Client.Age> 21
}

So each class contains a reference to the other as a property. Should this be avoided for any reason? Is there a simpler way of evaluating the properties of a given class, but separating that logic from the class itself by decorating it in one way or another?

discrete mathematics – Matrix representation for logic gates?

I've tried to find there are other logic circuits of matrix type representations, in the example below, $$ begin {bmatrix} 1 & 0 \ 1 & 1 \ end {bmatrix} equiv , , Rightarrow $$ or:

$$ begin {bmatrix} X, neg X end {bmatrix} begin {bmatrix} 1 & 0 \ 1 & 1 \ end {bmatrix} begin {bmatrix} Y \ neg Y end {bmatrix} = begin {bmatrix} X oplus neg X, X end {bmatrix} begin {bmatrix} Y \ neg Y \ end {bmatrix} = Y oplus neg X Y Y = X Rightarrow Y $$

Note that the juxtaposition of two variables without an operator corresponds to a conjunction, ie. $ XY = X wedge Y $.

Should the components of the Entity Component System model have logic?

We often read that in the entity component system model, we have to treat the components as a passive data structure without any logic. We are following a data-driven design approach with efficient cache utilization and increased performance.

I was developing a simple game using this rule and when the game got bigger I started to deal with some serious code smells such as code repeated in systems, suppose it's a shooter illustrating an example. In this shooting game, bullets were fired. So I've created a BulletComponent and a BulletSystem that manage collisions, cause damage and, if no collision occurs, the ball will disappear in five seconds. Then I wanted explosives and so I created ExplosiveComponent and ExplosionSystem. Once the explosive is placed, it explodes in ten seconds. At this point, we can notice the first code repeated between the systems, then we can make an abstraction and create a Duration component and a Duration system so that the bullet and the explosive contain it with the time that it should last. I want to create a particle effect in the area so that this abstraction is no longer valid because I want to perform different actions when the allotted time is up, but if I do like at the beginning, I have the repeated code between the systems (yuck!). This example is simple, but I deal with that with more complex things such as AI or reaction to collisions.

One solution that I thought was that I really wanted a ActionComponent with an ActionSystem that performs the action contained in the component, but in this way, I break the fact that the components only contain data and that they must not have logic! it's no longer a "hybrid" approach. But if you start thinking deeply, ActionSystem is very generic and you can do almost anything with it. It is therefore difficult to determine whether a system is necessary or not. The same can be applied to collisions, instead of having a lot of systems with logic for different colliding entities, you can just have a CollisionHandlerComponent with the logic for each entity.

I've found the following benefits by making generic systems like this one:

  • Greater flexibility (you can customize each entity easily)
  • No repeated code
  • Fewer systems (more performance?)

But as I said, the main disadvantage is that it is very confusing to have a system because it is possible to stick logic to the components.

Is it wrong to follow this kind of hybrid? If so, what would be your approach to the example without repeating the code in the systems?

Propositional logic – where is the error? [on hold]

I am a beginner but I thought I understood this subject, however (not one or b) and (not a b or a) is not equivalent to the original proposal. So where is the error?
Where is the error?

Nginx share server configuration logic without inclusion

The task is:

  • domaine.com/robot.txt send To permit text
  • staging.domain.com/robot.txt send Refuse text

The rest config for domain.com and staging.domain.com is the same.

So I know how to do that with understand additional file says serveur.cof which will contain the common configuration:

server {
# This is not applied to the staging. *
include server.conf;
location /robot.txt {...};
}

server {
server_name staging. *;
include server.conf;
location /robot.txt {...};
}

Is it possible to implement config for such a task without including and separating the file? I'm just wondering why such a simple mod staging.* url requires an extra file, etc.

Logic – Simple example of minimizing operator $ mu i $?

This is the definition of a minimization operator derived from Friendly Introduction to Mathematical Logic.

I have trouble understanding that. Can any one give me a simple example of a function $ g $ and $ ( mu i) g $ where does it apply?

Let $ g $ to be an arity function $ n + 1 $ of $ Bbb N ^ {n + 1} $ at $ Bbb
N $
.

Then, $ ( mu i)[g(x_1, dots, x_n, i)]$ denotes the smallest natural number
$ i $ as for all $ j <i $, the value of $ g (x_1, points x_n, j) $ is
a different natural number of $ 0 and the value of $ g (x_1,
points, x_n, i) $
is the natural number $ 0.

We can see $ ( mu i)[dots]$ as an operator on the functions. If we apply
the operator to a function of $ n + 1 $ variables, we get a function of
$ n $ variables.

error – FindEquationalProof with Logic in Wolfram Mathematica

You do not need TrouverEquationalProof for this purpose, just use the quantifiers.

For everyone[{a, b, c}, Implies[Implies[a, b] && implies[b, c], Involves[a, c]]];
Solve[%]

True

Check out Mathematica's help for more information. If you insist on using TrouverEquationalProof here, then you can apply the following axioms of propositional logic

shefferLogic = {ForAll[a, nand[nand[a, a], no[a, a]]== a],
For everyone[{a, b}, nand[a, nand[b, nand[b, b]]]== no[a, a]],
For everyone[Abc}{nand[no[anand[Abc}{nand[nand[anand[{abc}nand[non[anand[{abc}nand[nand[anand[b, c]], no[anand[anand[anand[anand[b, c]]]==
no[nand[nand[b, b], a], no[nand[c, c], a]]]}

, reformulating your theorem in terms of Sheffer's trait. Good luck!

Addition. Another way to prove it is to check if the formula defines tautology.

BooleanTable[ Implies[Implies[a, b] && implies[b, c], Involves[a, c]], {a, b, c}]

{True, True, True, True, True, True, True, True}

It should be noted that the formula considered is considered as an axiom in some systems of axioms of propositional calculus. See Wiki for more information.

First-order logic – Interpretation of free variables in theta under-consumption

How can we handle the free variable using theta-subsumption to order clauses based on generality.

I have three articles:

(1): p (X, X) <- s (X), t (X, Y).
(2): p (X, X) <- s (X), t (X, Y), t (X, Z).
(3): p (X, Y) <- s (X), t (X, Y).

How these two clauses 1st 2nd are equivalent? In second clause we have additional condition t (X, Z) which is not present in 1 a. Nowhere Z is a free variable so,

(1):can we replace it with Y?

(2):If that's the case, then why 3rd we are also not equivalent to 1st 2nd?