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
type 'a t = 'a -> bool
module Contravariant = Preface_make.Contravariant.Via_contramap (struct
type nonrec 'a t = 'a t
let contramap f g = Preface_core.Fun.(g % f)
end)
module Divisible =
Preface_make.Divisible.Over_contravariant
(Contravariant)
(struct
type nonrec 'a t = 'a t
let divide f pa pb x =
let (a, b) = f x in
pa a && pb b
;;
let conquer _ = true
end)
let negate p x = not (p x)
let tautology _ = true
let contradiction _ = false
let and_ l r x = l x && r x
let or_ l r x = l x || r x
module Infix = struct
let ( && ) = and_
let ( || ) = or_
let ( ! ) = negate
end
include Infix