-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathbool-kleene.agda
More file actions
52 lines (42 loc) Β· 846 Bytes
/
bool-kleene.agda
File metadata and controls
52 lines (42 loc) Β· 846 Bytes
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
-- Kleene's three-valued logic
module bool-kleene where
open import bool
open import eq
data πΉβ : Set where
tt : πΉβ
ff : πΉβ
uu : πΉβ
infix 7 ~β_
infixr 6 _&&β_
infixr 5 _||β_
--infixr 4 _impβ_
~β_ : πΉβ β πΉβ
~β tt = ff
~β ff = tt
~β uu = uu
-- and
_&&β_ : πΉβ β πΉβ β πΉβ
tt &&β b = b
ff &&β b = ff
uu &&β ff = ff
uu &&β b = uu
-- or
_||β_ : πΉβ β πΉβ β πΉβ
ff ||β b = b
tt ||β b = tt
uu ||β tt = tt
uu ||β b = uu
-- implication
_impβ_ : πΉβ β πΉβ β πΉβ
tt impβ b2 = b2
ff impβ b2 = tt
uu impβ tt = tt
uu impβ b = uu
knownβ : πΉβ β πΉ
knownβ tt = tt
knownβ ff = tt
knownβ uu = ff
to-πΉ : (b : πΉβ) β knownβ b β‘ tt β πΉ
to-πΉ tt p = tt
to-πΉ ff p = ff
to-πΉ uu ()