@@ -6,11 +6,11 @@ open import Ledger.Prelude hiding (compare; Rel)
66
77open import Agda.Builtin.FromNat
88open import Algebra using (Semiring)
9- open import Relation.Binary
10- open import Data.Nat.Properties using (+-*-semiring)
9+ open import Data.Nat.Properties using (+-monoˡ-≤; +-cancelˡ-<; +-*-semiring; suc-injective)
1110open import Data.Rational using (ℚ)
1211import Data.Rational as ℚ
1312import Data.Rational.Properties as ℚ
13+ open import Data.Sum using ([_,_]′)
1414
1515additionVia : ∀ {A : Set } → (A → A) → ℕ → A → A
1616additionVia sucFun zero r = r
@@ -49,6 +49,10 @@ record EpochStructure : Type₁ where
4949 ; <-resp-≈ = (λ where refl → id) , (λ where refl → id)
5050 }
5151
52+ field
53+ e<sucᵉ : ∀ {e : Epoch} → e < sucᵉ e
54+ ≤-predᵉ : ∀ {e e' : Epoch} → sucᵉ e ≤ sucᵉ e' → e ≤ e'
55+
5256 _ = _<_ {A = Slot} ⁇² ∋ it
5357 _ = _≤_ {A = Slot} ⁇² ∋ it
5458 _ = _<_ {A = Epoch} ⁇² ∋ it
@@ -94,12 +98,15 @@ record GlobalConstants : Type₁ where
9498 ℕEpochStructure : EpochStructure
9599 ℕEpochStructure = λ where
96100 .Slotʳ → +-*-semiring
101+ .DecPo-Slot → ℕ-hasDecPartialOrder
97102 .Epoch → ℕ
98103 .epoch slot → slot / SlotsPerEpochᶜ
99104 .firstSlot e → e * SlotsPerEpochᶜ
100105 .RandomnessStabilisationWindow → RandomnessStabilisationWindowᶜ
101106 .StabilityWindow → StabilityWindowᶜ
102107 .sucᵉ → suc
108+ .e<sucᵉ → +-monoˡ-≤ _ (>-nonZero⁻¹ SlotsPerEpochᶜ)
109+ .≤-predᵉ → [ (λ p → inj₁ (+-cancelˡ-< _ _ _ p)) , (λ p → inj₂ (suc-injective p)) ]′
103110 ._+ᵉ'_ → _+_
104111 .+ᵉ≡+ᵉ' {a} {b} → ℕ+ᵉ≡+ᵉ' {a} {b}
105112
0 commit comments