-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDuality.v
80 lines (61 loc) · 2.84 KB
/
Duality.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
From Top Require Import Lattice.
From Top Require Import LatticeProperties.
From Top Require Import BoundedLattice.
From Top Require Import ComplementedLattice.
From Top Require Import DistributiveLattice.
From Top Require Import BooleanLattice.
Generalizable All Variables.
Ltac dualize_goal :=
once (apply complement_both_sides || apply complement_both_sides_ineq);
repeat (rewrite demorgans_law_meet || rewrite demorgans_law_join).
Ltac dualize_hypothesis H :=
once (apply complement_both_sides in H || apply complement_both_sides_ineq in H);
repeat (rewrite demorgans_law_meet in H || rewrite demorgans_law_join in H).
Ltac duality :=
(* if there is a hypothesis, get its dual *)
(* note that this will only dualize the first hypothesis it sees *)
try (match goal with
| [ H : _ ≤ _ |- _ ] => dualize_hypothesis H
| [ H : _ = _ |- _ ] => dualize_hypothesis H
end);
(* get the dual of the goal *)
dualize_goal;
(* see if the dual already exists in the proof database *)
auto with mylatticeproofs.
(* tryif progress (auto with mylatticeproofs) then idtac else undo_dualize_goal. *)
Section Duality.
Hint Resolve join_commutative : mylatticeproofs.
Hint Resolve join_idempotent : mylatticeproofs.
Hint Resolve join_absorptive : mylatticeproofs.
Hint Resolve join_associative : mylatticeproofs.
Theorem meet_associative_boolean_slow_motion `{BooleanLattice A}: forall a b c:A, (a ⊓ b) ⊓ c = a ⊓ (b ⊓ c).
Proof.
intros.
apply complement_both_sides.
rewrite demorgans_law_meet.
rewrite demorgans_law_meet.
rewrite demorgans_law_meet.
rewrite demorgans_law_meet.
apply join_associative. (* same as: auto with mylatticeproofs. *)
Qed.
Theorem meet_associative_boolean `{BooleanLattice A}: forall a b c:A, (a ⊓ b) ⊓ c = a ⊓ (b ⊓ c).
Proof. intros. duality. Qed.
Theorem meet_commutative_boolean`{BooleanLattice A} : forall a b: A, a ⊓ b = b ⊓ a .
Proof. intros. duality. Qed.
Theorem meet_idempotent_boolean `{BooleanLattice A}: forall a : A, a ⊓ a = a.
Proof. intros. duality. Qed.
Theorem meet_absorptive_boolean `{BooleanLattice A}: forall a b : A, a ⊓ (a ⊔ b) = a.
Proof. intros. duality. Qed.
Hint Resolve meet_commutative : mylatticeproofs.
Hint Resolve meet_idempotent : mylatticeproofs.
Hint Resolve meet_absorptive : mylatticeproofs.
Hint Resolve meet_associative: mylatticeproofs.
Theorem join_associative_boolean `{BooleanLattice A}: forall a b c : A, (a ⊔ b) ⊔ c = a ⊔ (b ⊔ c).
Proof. intros. duality. Qed.
Theorem join_commutative_boolean `{BooleanLattice A}: forall a b : A, a ⊔ b = b ⊔ a.
Proof. intros. duality. Qed.
Theorem join_idempotent_boolean `{BooleanLattice A}: forall a : A, a ⊔ a = a.
Proof. intros. duality. Qed.
Theorem join_absorptive_boolean `{BooleanLattice A}: forall a b : A, a ⊔ (a ⊓ b) = a.
Proof. intros. duality. Qed.
End Duality.