Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [23:49] <logicmoo> https://en.wikipedia.org/wiki/NOR_logic#AND
- [23:50] <logicmoo> that daigram shows how to set up the I/Os
- [23:51] <logicmoo> https://en.wikipedia.org/wiki/NOR_logic#XOR shows you the one liner for XOR
- [23:54] <Defenestrate> im still having trouble working out how: [ ( A NOR A ) NOR ( B NOR B ) ] NOR
- [23:54] <Defenestrate> ( A NOR B ) mapped to your solution in prolog
- [23:56] <logicmoo> dont use the text use the picture
- [23:56] <Defenestrate> ok
- [23:56] <logicmoo> see this picure https://en.wikipedia.org/wiki/NOR_logic#/media/File:XOR_from_NOR.svg
- [23:56] <logicmoo> imagine those are wires..
- [23:57] <logicmoo> xor(A,B,Q):- nor(A,A,NotA), nor(B,B,NotB), nor(NotA,NotB,NotNorAB),nor(A,B,NorAB), nor(NotNorAB,NorAB,Q).
- [23:58] <logicmoo> label each wire a prolog varaible
- [23:59] <logicmoo> inside each gate write the nor(Wire1In,Wire2In,WireOut)
- [00:00] <logicmoo> so if you look at https://en.wikipedia.org/wiki/NOR_logic#/media/File:AND_from_NOR.svg
- [00:01] <logicmoo> and(A,B,Q):- nor(A,A,NotA), nor(B,B,NotB), ... What Goes Here?.
- [00:02] <Defenestrate> nor(notA,notB,Q) ?
- [00:02] <Defenestrate> is that right?
- [00:02] <logicmoo> perfect!
- [00:02] <Defenestrate> yay :))
- [00:03] <Defenestrate> but now that i have this rule: and(A,B,Q):- nor(A,A,NotA), nor(B,B,NotB), nor(notA, notB, Q).
- [00:03] <logicmoo> well closer to: nor(NotA,NotB,Q) :) vars need captialized
- [00:03] <Defenestrate> ah yes ofc
- [00:03] <Defenestrate> but would that work in prolog?
- [00:03] <logicmoo> yes
- [00:03] <Defenestrate> ok let me try
- [00:03] <Defenestrate> thank you so much, you're amazing at explaining
- [00:05] <Defenestrate> oh wow it works, thats amazing.
- [00:05] <logicmoo> i had not ever thought of this method before.. using the diagrams from that wiki page
- [00:05] <Defenestrate> prolog is so cool
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement