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
use prop::*;
use std::rc::Rc;
use prop::Either::*;
use prop::hooo::*;
fn main() {
}
pub type Safe<A> = ExcM<Tauto<A>>;
pub fn and_is_safe<A: Prop, B: Prop>(
safe_a: Safe<A>,
safe_b: Safe<B>
) -> Safe<And<A, B>> {
match (safe_a, safe_b) {
(Left(tauto_a), Left(tauto_b)) => Left(tauto_and(tauto_a, tauto_b)),
(Right(n_tauto_a), _) => Right(Rc::new(move |tauto_ab| {
n_tauto_a(tauto_rev_and(tauto_ab).0)
})),
(_, Right(n_tauto_b)) => Right(Rc::new(move |tauto_ab| {
n_tauto_b(tauto_rev_and(tauto_ab).1)
}))
}
}
pub fn or_is_safe<A: Prop, B: Prop>(
safe_a: Safe<A>,
safe_b: Safe<B>
) -> Safe<Or<A, B>> {
match (safe_a, safe_b) {
(Left(tauto_a), _) => Left(tauto_or_left(tauto_a)),
(_, Left(tauto_b)) => Left(tauto_or_right(tauto_b)),
(Right(n_tauto_a), Right(n_tauto_b)) => Right(Rc::new(move |tauto_or_ab| {
match tauto_rev_or(tauto_or_ab) {
Left(tauto_a) => n_tauto_a(tauto_a),
Right(tauto_b) => n_tauto_b(tauto_b),
}
}))
}
}
pub fn not_is_safe<A: DProp>(
safe_a: Safe<A>
) -> Safe<Not<A>> {
match safe_a {
Left(tauto_a) => Right(tauto_rev_not(tauto_not_double(tauto_a))),
Right(n_tauto_a) => Left(tauto_not(n_tauto_a)),
}
}