Ad

In other words, can I create every standard logic gate without using logical or logical bitwise operators and without using any other operators or constants, except in the first function?

Yes, I can.

Code
Diff
  • bool Nand(bool a, bool b){
      return 1-(a*b);
    }
    
    bool Not(bool a){
      return Nand(a, a);
    }
    
    bool And(bool a, bool b){
      return Not(Nand(a, b));
    }
    
    bool Nor(bool a, bool b){
      return And(Not(a), Not(b));
    }
    
    bool Or(bool a, bool b){
      return Not(Nor(a, b));
    }
    
    bool Xor(bool a, bool b){
      return And(Or(a, b), Not(And(a, b)));
    }
    
    bool Buffer(bool a){
      return Not(Not(a));
    }
    
    bool Xnor(bool a, bool b){
      return Not(Xor(a, b));
    }
    
    bool False(bool a){
      return And(a, Not(a));
    }
    
    bool True(bool a){
      return Or(a, Not(a));
    }
    • bool Or(bool a, bool b) {return a+b;}
    • bool And(bool a, bool b) {return a*b;}
    • bool Xor(bool a, bool b) {return a!=b;}
    • bool Nor(bool a, bool b) {return !a*!b;}
    • bool Nand(bool a, bool b) {return 1-a*b;}
    • bool Nand(bool a, bool b){
    • return 1-(a*b);
    • }
    • bool Not(bool a){
    • return Nand(a, a);
    • }
    • bool And(bool a, bool b){
    • return Not(Nand(a, b));
    • }
    • bool Nor(bool a, bool b){
    • return And(Not(a), Not(b));
    • }
    • bool Or(bool a, bool b){
    • return Not(Nor(a, b));
    • }
    • bool Xor(bool a, bool b){
    • return And(Or(a, b), Not(And(a, b)));
    • }
    • bool Buffer(bool a){
    • return Not(Not(a));
    • }
    • bool Xnor(bool a, bool b){
    • return Not(Xor(a, b));
    • }
    • bool False(bool a){
    • return And(a, Not(a));
    • }
    • bool True(bool a){
    • return Or(a, Not(a));
    • }