aboutsummaryrefslogtreecommitdiffhomepage
path: root/std/Logic.bruijn
blob: c2a12a481ff2913b6c19d159b5e2f360784672ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# MIT License, Copyright (c) 2022 Marvin Borner

:import std/Combinator .

not [0 F T]

!( not

:test (!T) (F)
:test (!F) (T)

and [[1 0 F]]

(&&) and

:test (T && T) (T)
:test (T && F) (F)
:test (F && T) (F)
:test (F && F) (F)

nand [[1 0 1 F T]]

:test (nand T T) (F)
:test (nand T F) (T)
:test (nand F T) (T)
:test (nand F F) (T)

or [[1 T 0]]

(||) or

:test (T || T) (T)
:test (T || F) (T)
:test (F || T) (T)
:test (F || F) (F)

nor [[1 1 0 F T]]

:test (nor T T) (F)
:test (nor T F) (F)
:test (nor F T) (F)
:test (nor F F) (T)

xor [[1 (not 0) 0]]

:test (xor T T) (F)
:test (xor T F) (T)
:test (xor F T) (T)
:test (xor F F) (F)

xnor [[1 0 (not 0)]]

:test (xnor T T) (T)
:test (xnor T F) (F)
:test (xnor F T) (F)
:test (xnor F F) (T)

if [[[2 1 0]]]

(?!) if

:test (if T T F) (T)
:test ((T ?! T) F) (T)
:test (if F T F) (F)
:test ((F ?! T) F) (F)

implies [[or (not 1) 0]]

(=>?) implies

:test (T =>? T) (T)
:test (T =>? F) (F)
:test (F =>? T) (T)
:test (F =>? F) (T)

iff [[and (implies 1 0) (implies 0 1)]]

(<=>?) iff

:test (T <=>? T) (T)
:test (T <=>? F) (F)
:test (F <=>? T) (F)
:test (F <=>? F) (T)