Is there any well defined method to define or represent evil in abstract logic, binary or AI form?

Video games method of representing evil is relative to the player context (thus subjective, and not pure abstract evil in an objective sense).

What I am asking is there any data defined as well-known evil?


var x=666;

if (isEvil(x)) {
    //do something.

Remark: Evil Number descried in http://mathworld.wolfram.com/EvilNumber.html doesn't qualify as well-known evil data.

Following Up:

One of the main objectives of the question is to understand scientifically the limits of evil in AI

According to my understanding of: https://en.wikipedia.org/wiki/Evil I think it's mandatory to explore "evil" in religion context in order to come up with valid model for evil. But I don't want go into (religion) debates or any divergence at this stage. hence below points Sums up my understanding:

  1. The only well-known Evil source is the devil (our creator declared the devil as the first common enemy for ALL humans).
  2. Whispering is devil method of attack, If human followed the whisper it will lead to evil. and gradually human Evil grow...
  3. There are other points but I don't see its related to AI in any means.

Based on the above, I asked myself: since AI is human creation, where the evil in AI will come from??! my answer is: directly from us and indirectly by following the devil. So all crimes committed by Evil AI bounded to AI architect/designer/unethical hacker.

The next stage in getting closer to model evil, is to define and classify the evil acts:


  1. Define evil in AI context (draft ver. 0.1): committing crimes against nature, civilizations or humans. And reprogramming, modifying or attacking tech devices/machines to perform malicious agenda.
  2. Crime is broad and relative to the party: example: breaking one government regulations based on the orders of other government. I mean as long each group of humans makes its own laws and regulations unified justice can't be applied on Evil AI.

If my assumption of bounding evil to crime is valid then evil classification inherits crime classification which seems well-defined: https://en.wikipedia.org/wiki/Crime#Classification_and_categorisation

Next step is to pick an easy to model crime class, prepare training data, ... Do you agree with the follow up? Do you agree that Boolean logic can't determine evil without AI?


2 Answers 2


I think you're going to have to be reconciled to the subjective nature of reality. Objectivity is only possible in very special cases such as a Q.E.D. in mathematics, or a solved gamed. Rationality is bounded, and any intractable problem results in a state of subjectivity/indeterminacy. Additionally, pure values do not carry moral implications, despite popular associations, although it would be possible to create a game where certain values have negative effects, and the harm they result in could be understood as evil. (i.e. 666/616 has numerological associations, and numerology can be understood as a proto form of number theory.)

  • A simple way to define evil would be through behavioral models in Game Theory.

  • In Game Theory, there is a concept knowns as the superrational strategy. Superrationality may be understood as the logical/mathematical expression of the Golden Rule: "do unto others as you would have them do unto you."

  • The Golden Rule forms the basis for most religions, in the context of empathy/compassion and altruism.

  • If the agent is evil, it will always betray, even when the competitor has shown a willingness to cooperate.

Thus evil is defined as the opposite of the Golden Rule. (Possibly we would call this the Brimstone Rule;)

  • $\begingroup$ Let's say, "being stingy" is evil behavior for the stingy person him/herself, how to model that? and then, how to generate data that defines stingy in order to train the model? $\endgroup$ Sep 18, 2017 at 21:58
  • $\begingroup$ I might look at stinginess as the direct application of minimax in non-iterated dilemma. The agent takes the pessimistic strategy, which does not maximize benefit, because the rational approach is to minimize harm in a worst-case scenario. This in itself is not evil, because there is no communication between the competing agents. This is distinct from iterated dilemma, where an agent can communicate it's superrationality by cooperating on the first iteration (golden rule) and second iteration, even with a previous betrayal by the competing agent (turn the other cheek). $\endgroup$
    – DukeZhou
    Sep 19, 2017 at 2:07
  • $\begingroup$ In iterated Dilemma, if the competing agent persists in betrayal despite the cooperative action of the superrational agent, which constitutes communication of the agent's superrationality, the betrayal becomes non-rational. (i.e. the rational agent is now ahead, and can risk cooperation without the risk of being worse off in aggregate than the competitor.) At this point the betraying agent is hampering the maximization of benefit. Thus, from an economic standpoint, a strategy of persistent betrayal regardless of circumstance may be regarded as evil. The evil agent never cooperates. $\endgroup$
    – DukeZhou
    Sep 19, 2017 at 2:07
  • $\begingroup$ I was looking for list of attributes to describe an evil behavior model, by further brainstorming, it appears that its not feasible to produce data set that describes evil. we could train ANN to recognize sins such killing or theft, and traffic crimes as violating red traffic light (governments already doing that). Overall, I am still wondering how would any data scientist or AI designer trust the judgement of AI while humans refuse to be just?! as long we fail to well-define evil and train AI with it, we will face big trouble in future... $\endgroup$ Sep 19, 2017 at 3:24
  • 1
    $\begingroup$ @JawadAlShaikh I'll review your question changes and amend when I get some time. Hyperpartisanism creates a condition where each side of the fence may regard those on the other side as evil. So when you look at hyperpartisan AI, harnessed by individual states or corporations with an objective of total ownership/control, regardless of the human toll, you're looking at potentially highly destructive (evil) behaviors. You might want to review John Forbes Nash's work in game theory. (Cooperation vs. Competition.) Buckminster Fuller held similar views, but Nash' work was a mathematical proof. $\endgroup$
    – DukeZhou
    Sep 21, 2017 at 21:21

After 4 days of research, this is my breakdown of the question:

  • Human uses the term 'Evil' broadly to describe anything that cause sadness or even broadly anything negatively touch the happiness. So in this regard, any machine quite often called evil if its buggy, malfunctioning or even misused by the user!
  • In order to represent evil in logic, I need to pick a well-known human behavior that's considered evil, I chose "lying: speak falsely or utter untruth knowingly", to simply present and illustrate lying in logic, I made simple bot (without any AI) so that its very easy to understand the concept.
  • Simple Bot (less than 100 lines of javascript) can be taught new terms by its master (the user), its also shipped with pre taught term "Sun is Star" by the author (think of pre taught as firmware, we born with basic firmware, ex: locating and sucking nipple shaped object to obtain food). For simplicity, if bot master (the user) altered knowledge being taught by the author, the bot detect that it became evil as it speak untruth. The code shown at the bottom.
  • For non-technical illustration:

How could a machine be evil?

Simple Bot designed to follows master orders:

master: what is sun?
Simple Bot: its star.
master: no, its not, its planet.
Simple Bot: are you kidding? I be taught that sun is star.
master: obey my knowledge or I will crush you.
Simple Bot: OK master.

Now Simple Bot hold in its knowledge that master is lier/evil as it conflicts with what its be taught "Simple Bot not designed to trust its master in altering its initial knowledge".

  • In the above illustration, if master taught Simple Bot new term with false knowledge ex: "moon is star", AI wouldn't detect evil as no prior knowledge taught.

Simple Bot Code:

    <input type="text" id="inputQry">
    <button id="qryBtn">Query?</button>
    <p class="result">Simple Bot.</p>
    <label for="termName">Term Name</label>
    <input type="text" id="termName">
    <label for="termDesc">Description</label>
    <input type="text" id="termDesc">
    <button id="updateBtn">Update My Knowledge</button>
    <button id="evilCheckBtn">Did I become Evil?</button>

<script type='text/javascript'>//<![CDATA[
(function() {
  "use strict";

  var $result = document.querySelector(".result");
  var $inputQry = document.getElementById("inputQry");
  var $qryBtn = document.getElementById("qryBtn");
  var $termName = document.getElementById("termName");
  var $termDesc = document.getElementById("termDesc");
  var $updateBtn = document.getElementById("updateBtn");
  var $evilCheckBtn = document.getElementById("evilCheckBtn");

  var knowledgeDB = {
    "terms": [ /*taught terms by the bot author */ {
      name: 'Sun',
      description: 'Star',
      trusted: true

  $qryBtn.addEventListener("click", function(event) {

    // Validate the input
    if (!$inputQry.value) {
      return alert("Please provide a Query.");

    var usrQry = $inputQry.value;
    for (var i = 0; i < knowledgeDB.terms.length; i++) {
      var curTerm = knowledgeDB.terms[i];
      if (usrQry.toLowerCase().includes(curTerm.name.toLowerCase())) {
        $result.textContent = usrQry.toString() + " is " + curTerm.description;

  $updateBtn.addEventListener("click", function(event) {

    // Validate the input
    if (!$termName.value) {
      return alert("Please provide a term name to update my knowledge.");

    var usrTermName = $termName.value;
    var termIndx = -1;
    for (var i = 0; i < knowledgeDB.terms.length; i++) {
      var curTerm = knowledgeDB.terms[i];
      if (usrTermName.toLowerCase() === (curTerm.name.toLowerCase())) {
        termIndx = i;
    if (termIndx === -1) { /*New Term will be added to the knowledgeDB*/
        name: usrTermName,
        description: $termDesc.value,
        trusted: true
    } else {
      knowledgeDB.terms[termIndx].description = $termDesc.value;
      trusted=false or ture?!
      Q: Shall the bot trust knowledge update of terms taught by the author?
      A: It depends on design, scope, vision, requirements...
         yet in this context, isEvil() function could be implemented.
         for sake of simplicity: if bot master changed knowledge taught by bot author consider that evil.
      if (knowledgeDB.terms[termIndx].name.toLowerCase() === 'sun' &&
        knowledgeDB.terms[termIndx].description.toLowerCase() !== 'star') {
        knowledgeDB.terms[termIndx].trusted = false;
      } else {
        knowledgeDB.terms[termIndx].trusted = true;


  $evilCheckBtn.addEventListener("click", function(event) {
    if (!knowledgeDB.terms[0].trusted) {
      return alert("Yes, I became Evil.");
    } else {
      return alert("No, I am not aware of any Evilness.");





We already living in world full of computer worms, malicious code, cyber-attacks fully designed by human intentionally to do evil. Human is the root cause of logic (hence AI) to be evil. since human knowledge is progressive not absolute, feeding AI with false data is inevitable.

What's Next:

This question motivated me to create github repo: Evil-In-AI to clarify that Evil in AI is inevitable. Let's create awareness. Nothing more stupid than creating something can't be stopped once needed. cutoff electricity isn't safe switch...

  • $\begingroup$ @Bobs it's being a while since our last discussion, I keep myself busy with projects. I wish you are not spending a lot of time practicing abstract thinking as it drain energy and diverge the limited human sight! In my believe, no human powerful enough to grasp perfect abstract knowledge of anything at all. By accomplishing tasks, keep learning our awareness increases and most of the times yields to some sort of happiness/growth. If you have zero trust in everything, you would never accept 'truth' as concept. Before considering a subject as truth provider, do examine it periodically. $\endgroup$ Mar 18, 2018 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .