-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab4.v
61 lines (57 loc) · 1.47 KB
/
Lab4.v
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
Require Import Labels.
From mathcomp Require Import ssreflect ssrfun ssrbool ssrnat eqtype seq.
(** The four point finite lattice (diamond shape) *)
Inductive Lab4 : Set :=
| L : Lab4
| M1 : Lab4
| M2 : Lab4
| H : Lab4.
Instance JoinSemiLattice_Lab4 : JoinSemiLattice Lab4 :=
{ bot := L
; join l1 l2 :=
match l1, l2 with
| _ , H => H
| H , _ => H
| L , _ => l2
| _ , L => l1
| M1, M2 => H
| M2, M1 => H
| _ , _ => l1 (* l1 == l2 *)
end
; flows l1 l2 :=
match l1, l2 with
| L , L => true
| L , M1 => true
| L , M2 => true
| L , H => true
| M1, M1 => true
| M1, H => true
| M2, M2 => true
| M2, H => true
| H , H => true
| _ , _ => false
end
; meet l1 l2 :=
match l1, l2 with
| _ , L => L
| L , _ => L
| H , _ => l2
| _ , H => l1
| M1, M2 => L
| M2, M1 => L
| _ , _ => l1 (* l1 == l2 *)
end
}.
Proof.
now intros l; destruct l; auto.
now intros l; destruct l; auto.
now intros l1 l2 l3; destruct l1, l2, l3; auto.
now intros l1 l2; destruct l1, l2; auto.
now intros l1 l2; destruct l1, l2; auto.
now intros l1 l2; destruct l1, l2; auto.
intros l1 l2 l; destruct l1, l2, l; auto.
Defined.
Instance Lattice_Lab4 : Lattice Lab4 := { top := H }.
Proof. intros l; destruct l; auto. Defined.
Instance FiniteLattice_Lab4 : FiniteLattice Lab4 := { elems := [:: L;M1;M2;H] }.
Proof. by case. Defined.