-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClosedSemiRingRecord.lagda
61 lines (52 loc) · 1.54 KB
/
ClosedSemiRingRecord.lagda
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
%if False
\begin{code}
module ClosedSemiRingRecord where
open import Relation.Binary.PropositionalEquality using (_≡_; refl)
import Relation.Binary.Reasoning.Setoid as EqReasoning
open import Algebra.Definitions using (LeftZero; RightZero)
open import Algebra.Structures using (module IsCommutativeMonoid;
IsCommutativeMonoid)
open import Data.Product
open import Data.Unit
open import Preliminaries
open import SemiNearRingRecord
open import SemiRingRecord
\end{code}
%endif
To define the transitive closure of a semi-ring we extend the Agda
record structure.
%
\savecolumns[CSR]
\begin{code}
record ClosedSemiRing : Set₁ where
field
sr : SemiRing
open SemiRing sr
open SemiNearRing snr
\end{code}
The defining equation for the closure of a semi-ring is |Eq w c|,
where |c| is the closure of |w|.
%
% We also want to capture that the
% closure of |w| is the least |c| such that |Eq w c| holds this is
% captured by |Closure w c|.
%
\restorecolumns[CSR]
\begin{code}
Eq : s → s → Set
Eq w c = c ≃s ones +s w *s c
Closure : s → s → Set
Closure w c = Least _≤s_ (Eq w) c
\end{code}
The field |entireQ| captures both the function computing the closure
and that |c| actually is the closure of |w|.
%
\restorecolumns[CSR]
\begin{code}
field
entireQ : Entire Eq -- |∀ a -> ∃ \ b → R a b|
closure : s → s
closure = fun entireQ
closureHasAll : {w : s} → Eq w (closure w) -- |w* ≃s ones +s w *s w*|
closureHasAll = correct entireQ
\end{code}