package smol

  1. Overview
  2. Docs

Source file algebra.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
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
(* TODO: doc, assumtpions (commutative etc) *)

module type Basic_S = sig
  type t

  val equal : t -> t -> bool

  val to_string : t -> string
end

module type Mul_Monoid_S = sig
  type t

  include Basic_S with type t := t

  val one : t

  val mul : t -> t -> t
end

module type Add_Monoid_S = sig
  type t

  include Basic_S with type t := t

  val zero : t

  val add : t -> t -> t
end

module type Add_Group_S = sig
  type t

  include Basic_S with type t := t

  include Add_Monoid_S with type t := t

  val neg : t -> t

  val sub : t -> t -> t
end

module type Semiring_S = sig
  type t

  include Basic_S with type t := t

  include Mul_Monoid_S with type t := t

  include Add_Monoid_S with type t := t
end

module type Ring_S = sig
  type t

  include Basic_S with type t := t

  include Mul_Monoid_S with type t := t

  include Add_Group_S with type t := t
end

module type Field_S = sig
  type t

  include Basic_S with type t := t

  include Ring_S with type t := t

  val inv : t -> t

  val div : t -> t -> t
end