Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Pythonic use of logic

Name: Anonymous 2013-06-27 11:43

I have noticed a disturbing trend in the Python community. The basic rule of Python is that there should be only one way to do a thing, and there are several logical operators in use. The proper way to use logic in Python is to only use one operator. To replace them all, we should use the NAND operator ("|").

For instance, consider the statement W↔(X∧(Y∨¬Z)). It is an ugly mess! It uses four different operators when only one should suffice.

This can obviously be reduced to only three operators: (¬W∨(¬(X∧Y)∧¬(X∧¬Z)))∧(((X∧Y)∧(X∧¬Z))∨W)

But this is not nearly far enough. By using the simple rules (A∨B) = (A|A)|(B|B), (A∧B)=(A|B)|(A|B), and ¬A=(A|A) (which should be self-evident, use a truth table to verify), we can reduce this entire expression to a beautiful (((((W|W)|(W|W))|((((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))|(((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))))|((W|W)|(((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z))))|((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z)))))))|((((W|W)|(W|W))|((((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))|(((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))))|((W|W)|(((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z))))|((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z)))))))). This is much more in line with the spirit of python than using multiple things when a single, simple operator will suffice.

Name: Anonymous 2013-06-27 12:12

write to guido, he will implement it in the next version of python 3

Name: Anonymous 2013-06-27 12:19

Python 4 gonna be candy sweet!

Please, tell Guido about http://en.wikipedia.org/wiki/Iota_and_Jot

Name: Anonymous 2013-06-27 12:40

>The basic rule of Python is that there should be only one way to do a thing
What kind of fucking retoid would come up with this?

Name: Anonymous 2013-06-27 12:43

Name: Anonymous 2013-06-27 12:46

(((((W|W)|(W|W))|((((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))|(((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))))|((W|W)|(((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z))))|((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z)))))))|((((W|W)|(W|W))|((((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))|(((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))))|((W|W)|(((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z))))|((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z))))))))
It's like Perl had sex with Lisp.

Name: Anonymous 2013-06-27 12:51

I had a frightening nightmare last night. Programmers started massively using languages which could not even get scoping right while others started building half-assed systems over JavaScript and HTML to badly emulate the capabilities of full-assed systems.
I fear it's actually happening.

Name: Anonymous 2013-06-27 12:58

>>7
As we realize ECMAScript/Web based applications are becoming very important and useful, ES operating system has been designed to make the Web Apps APIs as the primary operating system interfaces, and to be an extensible operating system by supporting the component technology from the operating system kernel level as originally proposed for the future direction by Noah Mendelsohn

Name: Anonymous 2013-06-27 12:59

>>8
Noah Mendelsohn
Shalom!

Name: Anonymous 2013-06-27 13:00

>>7
I share this feel.

It's not a good feel.

Name: Anonymous 2013-06-27 13:14

Perl: there's more than one way to do it;
Python: there should be only one way to do a thing;
Lisp: there should be a DSL to do it;
Haskell: do what? I've papers to publish;
C/C++: segmentation fault.

Name: Anonymous 2013-06-27 13:17

PHP: addslashes($_SESSION[$T_PAAMAYIM_NEKUDOTAYIM])

Name: Anonymous 2013-06-27 13:31

Well, either I'm wrong, you're wrong, or we're both wrong ;_;. It won't go back into a biconditional.

(((((W|W)|(W|W))|((((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))|(((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))))|((W|W)|(((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z))))|((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z)))))))|((((W|W)|(W|W))|((((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))|(((X|Y)|((X|(Z|Z))|(X|(Z|Z))))|((X|Y)|((X|(Z|Z))|(X|(Z|Z)))))))|((W|W)|(((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z))))|((((X|Y)|(X|Y))|(X|(Z|Z)))|(((X|Y)|(X|Y))|(X|(Z|Z))))))))

(Z|Z) -> ¬Z
(Y|Y) -> ¬Y
(X|X) -> ¬X
(W|W) -> ¬W
((((¬W|¬W)|((((X|Y)|((X|¬Z)|(X|¬Z)))|((X|Y)|((X|¬Z)|(X|¬Z))))|(((X|Y)|((X|¬Z)|(X|¬Z)))|((X|Y)|((X|¬Z)|(X|¬Z))))))|(¬W|(((((X|Y)|(X|Y))|(X|¬Z))|(((X|Y)|(X|Y))|(X|¬Z)))|((((X|Y)|(X|Y))|(X|¬Z))|(((X|Y)|(X|Y))|(X|¬Z))))))|(((¬W|¬W)|((((X|Y)|((X|¬Z)|(X|¬Z)))|((X|Y)|((X|¬Z)|(X|¬Z))))|(((X|Y)|((X|¬Z)|(X|¬Z)))|((X|Y)|((X|¬Z)|(X|¬Z))))))|(¬W|(((((X|Y)|(X|Y))|(X|¬Z))|(((X|Y)|(X|Y))|(X|¬Z)))|((((X|Y)|(X|Y))|(X|¬Z))|(((X|Y)|(X|Y))|(X|¬Z)))))))

(X|Y)|(X|Y) -> (X∧Y)
(X|¬Z)|(X|¬Z) -> (X∧¬Z)
(¬W|¬W) -> W
(X|Y) -> ¬(X∧Y)
(((W|(((¬(X∧Y)|((X∧¬Z)))|(¬(X∧Y)|((X∧¬Z))))|((¬(X∧Y)|((X∧¬Z)))|(¬(X∧Y)|((X∧¬Z))))))|(¬W|(((((X∧Y))|(X|¬Z))|(((X∧Y))|(X|¬Z)))|((((X∧Y))|(X|¬Z))|(((X∧Y))|(X|¬Z))))))|((W|(((¬(X∧Y)|((X∧¬Z)))|(¬(X∧Y)|((X∧¬Z))))|((¬(X∧Y)|((X∧¬Z)))|(¬(X∧Y)|((X∧¬Z))))))|(¬W|(((((X∧Y))|(X|¬Z))|(((X∧Y))|(X|¬Z)))|((((X∧Y))|(X|¬Z))|(((X∧Y))|(X|¬Z)))))))

(X|¬Z) -> お
(¬(X∧Y)|((X∧¬Z))) -> ん
(X∧Y) -> ぽ
(((W|((ん|ん)|(ん|ん)))|(¬W|((((ぽ)|お)|((ぽ)|お))|(((ぽ)|お)|((ぽ)|お)))))|((W|((ん|ん)|(ん|ん)))|(¬W|((((ぽ)|お)|((ぽ)|お))|(((ぽ)|お)|((ぽ)|お))))))

(ん|ん) -> ¬ん
(ぽ) -> ぽ
(ぽ|お)|(ぽ|お) -> ぽ∧お
(¬ん|¬ん) -> ん
(((W|ん)|(¬W|((ぽ∧お)|(ぽ∧お))))|((W|ん)|(¬W|((ぽ∧お)|(ぽ∧お)))))

(ぽ∧お) -> あ
(((W|ん)|(¬W|(あ|あ)))|((W|ん)|(¬W|(あ|あ))))

(あ|あ) -> ¬あ
(((W|ん)|(¬W|¬あ))|((W|ん)|(¬W|¬あ)))

(W|ん) - > く
(¬W|¬あ) -> ら
((く|ら)|(く|ら))
=> く∧ら

ら -> ¬(¬W∧¬あ)
く -> ¬(W∧ん)
¬(W∧ん)∧¬(¬W∧¬あ)

あ -> (ぽ∧お)
¬(W∧ん)∧¬(¬W∧¬(ぽ∧お))

¬(ぽ∧お) -> (¬ぽ∨¬お)
¬(W∧ん) -> (¬W∨¬ん)
(¬W∨¬ん)∧¬(¬W∧¬(ぽ∧お))

ん -> ¬(¬(X∧Y)∧(X∧¬Z)) -> ((X∧Y)∨¬(X∧¬Z))
(¬W∨¬((X∧Y)∨¬(X∧¬Z)))∧¬(¬W∧(¬ぽ∨¬お))

¬(X∧¬Z) -> (¬X∨Z)
ぽ -> (X∧Y)
お -> ¬(X∧¬Z) -> (¬X∨Z)
(¬W∨¬((X∧Y)∨(¬X∨Z)))∧¬(¬W∧¬((X∧Y)∧(¬X∨Z)))

¬(¬W∧¬((X∧Y)∧(¬X∨Z))) -> (W∨((X∧Y)∧(¬X∨Z)))
(¬W∨¬((X∧Y)∨(¬X∨Z)))∧(W∨((X∧Y)∧(¬X∨Z)))

(¬X∨Z) -> (X→Z)
¬(X∧¬Z) -> (¬X∨Z)
(¬W∨¬((X∧Y)∨(X→Z)))∧(W∨((X∧Y)∧(X→Z)))

¬((X∧Y)∨(X→Z)) -> (¬(X∧Y)∧(X→Z))
(¬W∨(¬(X∧Y)∧(X→Z)))∧(W∨((X∧Y)∧(X→Z)))

¬(X∧Y) -> (¬X∨¬Y) -> (X→¬Y)
(X∧Y) -> ¬(¬X∨¬Y) -> ¬(X→¬Y)
(¬W∨((X→¬Y)∧(X→Z)))∧(W∨(¬(X→¬Y)∧(X→Z)))

(¬W∨((X→¬Y)∧(X→Z))) -> (W→((X→¬Y)∧(X→Z)))
(W∨(¬(X→¬Y)∧(X→Z))) -> (¬W→(¬(X→¬Y)∧(X→Z)))
(W→((X→¬Y)∧(X→Z)))∧(¬W→(¬(X→¬Y)∧(X→Z)))

(¬W→(¬(X→¬Y)∧(X→Z))) -> (¬(¬(X→¬Y)∧(X→Z))→W)
(W→((X→¬Y)∧(X→Z)))∧(¬(¬(X→¬Y)∧(X→Z))→W)


And so close too! But even ignoring that:
Assume instead: (W→((X→¬Y)∧(X→Z)))∧(((X→¬Y)∧(X→Z))→W)
(W↔((X→¬Y)∧(X→Z)))
((X→¬Y)∧(X→Z)) -> (¬X∨(¬Y∧Z))
(W↔(¬X∨(¬Y∧Z)))


Which is clearly not correct either.

Name: Anonymous 2013-06-27 13:45

(X∧(Y∨¬Z)) -> (X|((Y|Y)|Z))|(X|((Y|Y)|Z))

Name: Anonymous 2013-06-27 13:50

>>4
le /g/uotes
>>10
le feels

>muh facebook when

Name: Anonymous 2013-06-27 13:51

Those NAND-only expressions have about as much clarity to them as Brainfuck code.

Anyhoot, "Pythonian Logick FTW".

Name: Anonymous 2013-06-27 13:52

>>4
A kike like Guido, obviously.

Name: Anonymous 2013-06-27 14:12

ONE WORD, THE FORCED SHEFFERIZATION OF LOGIC, THREAD OVER

Name: Anonymous 2013-06-27 14:27

>>18
It's 5 words, you moron.

Name: Anonymous 2013-06-27 14:30

>>19
One word: /le backseat bop/.

Name: Anonymous 2013-06-27 14:31

>>18
On the hardware level, going NAND-only makes economic sense - it's cheaper to produce ICs that only include one type of gate, and the NAND logical operation is the only one all others can be reduced to.

Name: Anonymous 2013-06-27 16:19

FIOC is still shit.

Name: Anonymous 2013-06-27 18:31

>>8
Oh my! It actually exists. Why. Why. Why. ;_;

Name: Anonymous 2013-06-27 20:15

FSOL

Name: Anonymous 2013-06-28 0:50

>>21

What about NOR?

Name: Anonymous 2013-06-28 1:01

>>25
NOR gates are indeed functionally complete as well. Still pure NOR logic they're mostly slower than NAND logic, thus the former is less prevalent.

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-06-28 8:30

>>21,25,26
Looks liekw e have a acse of the typacial "sofowater idiotss whoa know notig about REAL harware but just the acrap fedd to them byt extboosk...

IC desgign is a COMPELELY different discpline. BOTH regulart gates and COMPUOND oes are usedin. AOI OAI

apollo computer used all3 -input RTL NOR gats. In NMOS NOR is faster than NAND becase the paraalel pulldowns.
http://www.amazon.com/VLSI-Design-Circuits-Michael-Vai/dp/0849318769
http://www.cmosvlsi.com/ http://www.mosis.com/pages/support/text-books
Nowgo edcate yourselves.

Name: Anonymous 2013-06-28 8:49

>>27
DRUNK BITCH

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2013-06-28 8:52

tyringa to do myusual 140wpm ona touchacreen. cantne arsed to fisx it.

Name: Anonymous 2013-06-28 9:04

>>29
Why are you using shit for monkeys? Why don't you fucking fix your posts?

Name: Anonymous 2013-06-28 9:29

>>13
>>1 got it wrong. If you fill in 0 for all variables in both expressions:

0↔(0∧(0∨¬0))
= 0↔(0∧1)
= 0↔0
= 1

(((((0|0)|(0|0))|((((0|0)|((0|(0|0))|(0|(0|0))))|((0|0)|((0|(0|0))|(0|(0|0)))))|(((0|0)|((0|(0|0))|(0|(0|0))))|((0|0)|((0|(0|0))|(0|(0|0)))))))|((0|0)|(((((0|0)|(0|0))|(0|(0|0)))|(((0|0)|(0|0))|(0|(0|0))))|((((0|0)|(0|0))|(0|(0|0)))|(((0|0)|(0|0))|(0|(0|0)))))))|((((0|0)|(0|0))|((((0|0)|((0|(0|0))|(0|(0|0))))|((0|0)|((0|(0|0))|(0|(0|0)))))|(((0|0)|((0|(0|0))|(0|(0|0))))|((0|0)|((0|(0|0))|(0|(0|0)))))))|((0|0)|(((((0|0)|(0|0))|(0|(0|0)))|(((0|0)|(0|0))|(0|(0|0))))|((((0|0)|(0|0))|(0|(0|0)))|(((0|0)|(0|0))|(0|(0|0))))))))
= ((((1|1)|(((1|((0|1)|(0|1)))|(1|((0|1)|(0|1))))|((1|((0|1)|(0|1)))|(1|((0|1)|(0|1))))))|(1|((((1|1)|(0|1))|((1|1)|(0|1)))|(((1|1)|(0|1))|((1|1)|(0|1))))))|(((1|1)|(((1|((0|1)|(0|1)))|(1|((0|1)|(0|1))))|((1|((0|1)|(0|1)))|(1|((0|1)|(0|1))))))|(1|((((1|1)|(0|1))|((1|1)|(0|1)))|(((1|1)|(0|1))|((1|1)|(0|1)))))))
= (((0|(((1|0)|(1|0))|((1|0)|(1|0))))|(1|(0|0)))|((0|(((1|0)|(1|0))|((1|0)|(1|0))))|(1|(0|0))))
= (((0|(0|0))|(1|(0|0)))|((0|(0|0))|(1|(0|0))))
= (((0|1)|(1|1))|((0|1)|(1|1)))
= ((1|0)|(1|0))
= (1|1)
= 0

Name: Anonymous 2013-06-28 9:31

>>29
Fuck off.

Name: Anonymous 2013-09-01 13:30


In 1900, in the Paris conference of the International Congress of Mathematicians, David Hilbert challenged the mathematical community with his famous Hilbert's problems, a list of 23 unsolved fundamental questions which mathematicians should attack during the coming century. The first of these, a problem of set theory, was the continuum hypothesis introduced by Cantor in 1878, and in the course of its statement Hilbert mentioned also the need to prove the well-ordering theorem.

Name: Anonymous 2013-09-01 13:32

>>33
Sick dubs, bro!

Name: Anonymous 2013-09-01 15:47


Symmetric difference of sets A and B, denoted A △ B or A ⊖ B, is the set of all objects that are a member of exactly one of A and B (elements which are in one of the sets, but not in both). For instance, for the sets {1,2,3} and {2,3,4} , the symmetric difference set is {1,4} . It is the set difference of the union and the intersection, (A ∪ B) \ (A ∩ B) or (A \ B) ∪ (B \ A).

Name: Anonymous 2013-09-07 16:48

FSOL

Name: Anonymous 2013-09-07 16:52

>>33
Sick dubs, Franky. Did you get to meet Hilbert in Pari?

Name: Anonymous 2013-09-07 17:09

Is logic turning complete?

Don't change these.
Name: Email:
Entire Thread Thread List