package preface

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file bounded_lattice.ml

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
open QCheck2

module Suite
    (R : Model.COVARIANT_0)
    (L : Preface_specs.BOUNDED_LATTICE with type t = R.t) =
struct
  module Laws = Preface_laws.Bounded_lattice.For (L)

  let print = Format.asprintf "%a" R.pp

  module Bounded_join_semilattice = Bounded_join_semilattice.Suite (R) (L)
  module Bounded_meet_semilattice = Bounded_meet_semilattice.Suite (R) (L)

  let bounded_lattice_1 count =
    let print = Print.tup2 print print in
    let generator = Gen.tup2 R.generator R.generator in
    Util.test ~count ~print generator Laws.bounded_lattice_1
      (fun lhs rhs (a, b) ->
        let left = lhs a b
        and right = rhs a b in
        R.equal left right )
  ;;

  let bounded_lattice_2 count =
    let print = Print.tup2 print print in
    let generator = Gen.tup2 R.generator R.generator in
    Util.test ~count ~print generator Laws.bounded_lattice_1
      (fun lhs rhs (a, b) ->
        let left = lhs a b
        and right = rhs a b in
        R.equal left right )
  ;;

  let tests ~count =
    Bounded_join_semilattice.tests ~count
    @ Bounded_meet_semilattice.tests ~count
    @ [ bounded_lattice_1 count; bounded_lattice_2 count ]
  ;;
end
OCaml

Innovation. Community. Security.