Prolog Assignment
- Implement OR, AND, and NOT gates in a declarative fashion.
- Implement XOR, NOR, NAND, and XNOR gates with rules or in a declarative fashion (bonus points for using rules/relationships).
- Implement the half-adder circuit
- Implement the full-adder circuit using the half-adder.
Since SWI prolog already has implementations of several of these, you should name your declarations/rules in the following fashion:
.and_(input, input, output)
.or_(…)
.not_(…)
.xor_(…)
.nor_(…) :- …
.xnor_(…) :-…
.nand_(…) :-…
.half_adder(A, B, C, S) :- …
.full_adder(A, B, Cin, Cout, S) :- …
Resources: