{-# OPTIONS --safe #-}

open import Ledger.Conway.Specification.Gov.Base

module Ledger.Conway.Specification.Gov.Actions (gs : _) (open GovStructure gs) where

open import Data.Nat.Properties using (+-0-monoid)
open import Data.Rational using (; 0ℚ; 1ℚ)

open import Tactic.Derive.Show

open import Ledger.Prelude as P hiding (yes; no)


data GovRole : Type where
  CC DRep SPO : GovRole


instance
  unquoteDecl Show-GovRole = derive-Show [ (quote GovRole , Show-GovRole) ]


GovRoleCredential : GovRole  Type
GovRoleCredential CC   = Credential
GovRoleCredential DRep = Credential
GovRoleCredential SPO  = KeyHash


data GovActionType : Type where
  NoConfidence        : GovActionType
  UpdateCommittee     : GovActionType
  NewConstitution     : GovActionType
  TriggerHardFork     : GovActionType
  ChangePParams       : GovActionType
  TreasuryWithdrawal  : GovActionType
  Info                : GovActionType


record HasGovActionType (A : Type) : Type where
  field GovActionTypeOf : A  GovActionType
open HasGovActionType ⦃...⦄ public


GovActionData : GovActionType  Type
GovActionData NoConfidence        = 
GovActionData UpdateCommittee     = (Credential  Epoch) ×  Credential × 
GovActionData NewConstitution     = DocHash × Maybe ScriptHash
GovActionData TriggerHardFork     = ProtVer
GovActionData ChangePParams       = PParamsUpdate
GovActionData TreasuryWithdrawal  = Withdrawals
GovActionData Info                = 


record GovAction : Type where


  constructor ⟦_,_⟧ᵍᵃ


  field
    gaType : GovActionType
    gaData : GovActionData gaType


open GovAction public

record HasGovAction (A : Type) : Type where
  field GovActionOf : A  GovAction
open HasGovAction ⦃...⦄ public

instance
  HasGovActionType-GovAction : HasGovActionType GovAction
  HasGovActionType-GovAction .GovActionTypeOf = GovAction.gaType

  HasCast-GovAction-Sigma : HasCast GovAction (Σ GovActionType GovActionData)
  HasCast-GovAction-Sigma .cast x = x .gaType , x .gaData


GovActionID : Type
GovActionID  = TxId × 


data Vote : Type where
  yes no abstain  : Vote


record GovVoter : Type where


  constructor ⟦_,_⟧ᵍᵛ


  field
    gvRole       : GovRole
    gvCredential : GovRoleCredential gvRole


record Anchor : Type where
  field
    url   : String
    hash  : DocHash


record GovVote : Type where
  field
    gid         : GovActionID
    voter       : GovVoter
    vote        : Vote
    anchor      : Maybe Anchor


record GovVotes : Type where
  field
    gvCC   : Credential  Vote
    gvDRep : Credential  Vote
    gvSPO  : KeyHash  Vote


data VDeleg : Type where
  vDelegCredential   : Credential  VDeleg
  vDelegAbstain      : VDeleg
  vDelegNoConfidence : VDeleg

VoteDelegs : Type
VoteDelegs   = Credential  VDeleg


record HasVoteDelegs {a} (A : Type a) : Type a where
  field VoteDelegsOf : A  VoteDelegs
open HasVoteDelegs ⦃...⦄ public


NeedsHash : GovActionType  Type
NeedsHash NoConfidence        = GovActionID
NeedsHash UpdateCommittee     = GovActionID
NeedsHash NewConstitution     = GovActionID
NeedsHash TriggerHardFork     = GovActionID
NeedsHash ChangePParams       = GovActionID
NeedsHash TreasuryWithdrawal  = 
NeedsHash Info                = 

HashProtected : Type  Type
HashProtected A = A × GovActionID


instance
  HasCast-HashProtected :  {A : Type}  HasCast (HashProtected A) A
  HasCast-HashProtected .cast = proj₁

  HasCast-HashProtected-MaybeScriptHash : HasCast (HashProtected (DocHash × Maybe ScriptHash)) (Maybe ScriptHash)
  HasCast-HashProtected-MaybeScriptHash .cast = proj₂  proj₁


Policy : Type
Policy = Maybe ScriptHash

record GovProposal : Type where
  field
    action      : GovAction
    prevAction  : NeedsHash (gaType action)
    policy      : Policy
    deposit     : Coin
    returnAddr  : RewardAddress
    anchor      : Anchor


record GovActionState : Type where
  field
    votes       : GovVotes
    returnAddr  : RewardAddress
    expiresIn   : Epoch
    action      : GovAction
    prevAction  : NeedsHash (gaType action)


record HasGovVoter {a} (A : Type a) : Type a where
  field GovVoterOf : A  GovVoter
open HasGovVoter ⦃...⦄ public

record HasVote {a} (A : Type a) : Type a where
  field VoteOf : A  Vote
open HasVote ⦃...⦄ public

record HasPolicy {a} (A : Type a) : Type a where
  field PolicyOf : A  Policy
open HasPolicy ⦃...⦄ public

instance
  HasGovVoter-GovVote : HasGovVoter GovVote
  HasGovVoter-GovVote .GovVoterOf = GovVote.voter

  HasVote-GovVote : HasVote GovVote
  HasVote-GovVote .VoteOf = GovVote.vote

  HasPolicy-GovProposal : HasPolicy GovProposal
  HasPolicy-GovProposal .PolicyOf = GovProposal.policy

  HasGovAction-GovProposal : HasGovAction GovProposal
  HasGovAction-GovProposal .GovActionOf = GovProposal.action

  HasGovAction-GovActionState : HasGovAction GovActionState
  HasGovAction-GovActionState .GovActionOf = GovActionState.action

  HasGovActionType-GovProposal : HasGovActionType GovProposal
  HasGovActionType-GovProposal .GovActionTypeOf = GovActionTypeOf  GovActionOf

  HasGovActionType-GovActionState : HasGovActionType GovActionState
  HasGovActionType-GovActionState .GovActionTypeOf = GovActionTypeOf  GovActionOf

instance
  unquoteDecl DecEq-GovActionType = derive-DecEq ((quote GovActionType , DecEq-GovActionType)  [])
  unquoteDecl DecEq-GovRole       = derive-DecEq ((quote GovRole , DecEq-GovRole)  [])
  unquoteDecl DecEq-Vote          = derive-DecEq ((quote Vote    , DecEq-Vote)     [])
  unquoteDecl DecEq-VDeleg        = derive-DecEq ((quote VDeleg  , DecEq-VDeleg)   [])

  DecEq-GovVoter : DecEq GovVoter
  DecEq-GovVoter ._≟_ $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#369}{\htmlId{5596}{\htmlClass{InductiveConstructor}{\text{CC}}}}\,   \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#5603}{\htmlId{5603}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix}$ $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#369}{\htmlId{5611}{\htmlClass{InductiveConstructor}{\text{CC}}}}\,   \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#5618}{\htmlId{5618}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix}$
    with c  c'
  ... | P.yes p = P.yes (cong $\begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#369}{\htmlId{5673}{\htmlClass{InductiveConstructor}{\text{CC}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#5655}{\htmlId{5682}{\htmlClass{Bound}{\text{p}}}}\,\,\htmlId{5683}{\htmlClass{Symbol}{\text{)}}}\,
  \,\htmlId{5687}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{5691}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{5693}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#5698}{\htmlId{5698}{\htmlClass{Bound}{\text{¬p}}}}\, \,\htmlId{5701}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{5703}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{5708}{\htmlClass{Symbol}{\text{(λ}}}\, \,\htmlId{5711}{\htmlClass{Symbol}{\text{{}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{5713}{\htmlClass{InductiveConstructor}{\text{refl}}}}\, \,\htmlId{5718}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#5698}{\htmlId{5720}{\htmlClass{Bound}{\text{¬p}}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{5723}{\htmlClass{InductiveConstructor}{\text{refl}}}}\,\,\htmlId{5727}{\htmlClass{Symbol}{\text{})}}}\,
  \,\href{Ledger.Conway.Specification.Gov.Actions.html#5540}{\htmlId{5732}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{5747}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{5748}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#369}{\htmlId{5754}{\htmlClass{InductiveConstructor}{\text{CC}}}}\,   \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#5761}{\htmlId{5761}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#372}{\htmlId{5769}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, \\ \,\href{Ledger.Conway.Specification.Gov.Actions.html#5776}{\htmlId{5776}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{5783}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{5785}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{5790}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{5792}{\htmlClass{Symbol}{\text{()}}}\,
  \,\href{Ledger.Conway.Specification.Gov.Actions.html#5540}{\htmlId{5797}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{5812}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{5813}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#369}{\htmlId{5819}{\htmlClass{InductiveConstructor}{\text{CC}}}}\,   , \,\href{Ledger.Conway.Specification.Gov.Actions.html#5826}{\htmlId{5826}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#377}{\htmlId{5834}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\,  , \,\href{Ledger.Conway.Specification.Gov.Actions.html#5841}{\htmlId{5841}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{5848}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{5850}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{5855}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{5857}{\htmlClass{Symbol}{\text{()}}}\,
  \,\href{Ledger.Conway.Specification.Gov.Actions.html#5540}{\htmlId{5862}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{5877}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{5878}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#372}{\htmlId{5884}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#5891}{\htmlId{5891}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#369}{\htmlId{5899}{\htmlClass{InductiveConstructor}{\text{CC}}}}\,   , \,\href{Ledger.Conway.Specification.Gov.Actions.html#5906}{\htmlId{5906}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{5913}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{5915}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{5920}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{5922}{\htmlClass{Symbol}{\text{()}}}\,
  \,\href{Ledger.Conway.Specification.Gov.Actions.html#5540}{\htmlId{5927}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{5942}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{5943}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#372}{\htmlId{5949}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#5956}{\htmlId{5956}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#372}{\htmlId{5964}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#5971}{\htmlId{5971}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix}
    \,\htmlId{5982}{\htmlClass{Keyword}{\text{with}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#5956}{\htmlId{5987}{\htmlClass{Bound}{\text{c}}}}\, \,\href{Class.DecEq.Core.html#168}{\htmlId{5989}{\htmlClass{Field Operator}{\text{≟}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#5971}{\htmlId{5991}{\htmlClass{Bound}{\text{c'}}}}\,
  \,\htmlId{5996}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{6000}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2099}{\htmlId{6002}{\htmlClass{InductiveConstructor}{\text{P.yes}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6008}{\htmlId{6008}{\htmlClass{Bound}{\text{p}}}}\, \,\htmlId{6010}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2099}{\htmlId{6012}{\htmlClass{InductiveConstructor}{\text{P.yes}}}}\, \,\htmlId{6018}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Relation.Binary.PropositionalEquality.Core.html#1481}{\htmlId{6019}{\htmlClass{Function}{\text{cong}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#372}{\htmlId{6026}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6008}{\htmlId{6037}{\htmlClass{Bound}{\text{p}}}}\,\,\htmlId{6038}{\htmlClass{Symbol}{\text{)}}}\,
  \,\htmlId{6042}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{6046}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{6048}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6053}{\htmlId{6053}{\htmlClass{Bound}{\text{¬p}}}}\, \,\htmlId{6056}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{6058}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{6063}{\htmlClass{Symbol}{\text{(λ}}}\, \,\htmlId{6066}{\htmlClass{Symbol}{\text{{}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{6068}{\htmlClass{InductiveConstructor}{\text{refl}}}}\, \,\htmlId{6073}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6053}{\htmlId{6075}{\htmlClass{Bound}{\text{¬p}}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{6078}{\htmlClass{InductiveConstructor}{\text{refl}}}}\,\,\htmlId{6082}{\htmlClass{Symbol}{\text{})}}}\,
  \,\href{Ledger.Conway.Specification.Gov.Actions.html#5540}{\htmlId{6087}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{6102}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{6103}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#372}{\htmlId{6109}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6116}{\htmlId{6116}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#377}{\htmlId{6124}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\,  , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6131}{\htmlId{6131}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{6138}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{6140}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{6145}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{6147}{\htmlClass{Symbol}{\text{()}}}\,
  \,\href{Ledger.Conway.Specification.Gov.Actions.html#5540}{\htmlId{6152}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{6167}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{6168}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#377}{\htmlId{6174}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\,  , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6181}{\htmlId{6181}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#369}{\htmlId{6189}{\htmlClass{InductiveConstructor}{\text{CC}}}}\,   , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6196}{\htmlId{6196}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{6203}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{6205}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{6210}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{6212}{\htmlClass{Symbol}{\text{()}}}\,
  \,\href{Ledger.Conway.Specification.Gov.Actions.html#5540}{\htmlId{6217}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{6232}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{6233}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#377}{\htmlId{6239}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\,  , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6246}{\htmlId{6246}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#372}{\htmlId{6254}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6261}{\htmlId{6261}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix} \,\htmlId{6268}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{6270}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{6275}{\htmlClass{Symbol}{\text{λ}}}\, \,\htmlId{6277}{\htmlClass{Symbol}{\text{()}}}\,
  \,\href{Ledger.Conway.Specification.Gov.Actions.html#5540}{\htmlId{6282}{\htmlClass{Function}{\text{DecEq-GovVoter}}}}\, \,\htmlId{6297}{\htmlClass{Symbol}{\text{.}}}\,\,\href{Class.DecEq.Core.html#168}{\htmlId{6298}{\htmlClass{Field Operator}{\text{\_≟\_}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#377}{\htmlId{6304}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\,  , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6311}{\htmlId{6311}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#377}{\htmlId{6319}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\,  , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6326}{\htmlId{6326}{\htmlClass{Bound}{\text{c'}}}}\, \end{pmatrix}
    \,\htmlId{6337}{\htmlClass{Keyword}{\text{with}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6311}{\htmlId{6342}{\htmlClass{Bound}{\text{c}}}}\, \,\href{Class.DecEq.Core.html#168}{\htmlId{6344}{\htmlClass{Field Operator}{\text{≟}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6326}{\htmlId{6346}{\htmlClass{Bound}{\text{c'}}}}\,
  \,\htmlId{6351}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{6355}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2099}{\htmlId{6357}{\htmlClass{InductiveConstructor}{\text{P.yes}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6363}{\htmlId{6363}{\htmlClass{Bound}{\text{p}}}}\, \,\htmlId{6365}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2099}{\htmlId{6367}{\htmlClass{InductiveConstructor}{\text{P.yes}}}}\, \,\htmlId{6373}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Relation.Binary.PropositionalEquality.Core.html#1481}{\htmlId{6374}{\htmlClass{Function}{\text{cong}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#377}{\htmlId{6381}{\htmlClass{InductiveConstructor}{\text{SPO}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6363}{\htmlId{6391}{\htmlClass{Bound}{\text{p}}}}\,\,\htmlId{6392}{\htmlClass{Symbol}{\text{)}}}\,
  \,\htmlId{6396}{\htmlClass{Symbol}{\text{...}}}\, \,\htmlId{6400}{\htmlClass{Symbol}{\text{|}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{6402}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6407}{\htmlId{6407}{\htmlClass{Bound}{\text{¬p}}}}\, \,\htmlId{6410}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Relation.Nullary.Decidable.Core.html#2136}{\htmlId{6412}{\htmlClass{InductiveConstructor}{\text{P.no}}}}\, \,\htmlId{6417}{\htmlClass{Symbol}{\text{(λ}}}\, \,\htmlId{6420}{\htmlClass{Symbol}{\text{{}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{6422}{\htmlClass{InductiveConstructor}{\text{refl}}}}\, \,\htmlId{6427}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6407}{\htmlId{6429}{\htmlClass{Bound}{\text{¬p}}}}\, \,\href{Agda.Builtin.Equality.html#207}{\htmlId{6432}{\htmlClass{InductiveConstructor}{\text{refl}}}}\,\,\htmlId{6436}{\htmlClass{Symbol}{\text{})}}}\,

  \,\htmlId{6442}{\htmlClass{Keyword}{\text{unquoteDecl}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6454}{\htmlId{6454}{\htmlClass{Function}{\text{HasCast-GovVote}}}}\, \,\htmlId{6470}{\htmlClass{Symbol}{\text{=}}}\, \,\href{stdlib-classes.Class.HasCast.Derive.html#2690}{\htmlId{6472}{\htmlClass{Function}{\text{derive-HasCast}}}}\, \,\href{Data.List.Base.html#4907}{\htmlId{6487}{\htmlClass{Function Operator}{\text{[}}}}\, \,\htmlId{6489}{\htmlClass{Symbol}{\text{(}}}\,\,\htmlId{6490}{\htmlClass{Keyword}{\text{quote}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#2294}{\htmlId{6496}{\htmlClass{Record}{\text{GovVote}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6454}{\htmlId{6506}{\htmlClass{Function}{\text{HasCast-GovVote}}}}\,\,\htmlId{6521}{\htmlClass{Symbol}{\text{)}}}\, \,\href{Data.List.Base.html#4907}{\htmlId{6523}{\htmlClass{Function Operator}{\text{]}}}}\,

  \,\htmlId{6528}{\htmlClass{Keyword}{\text{unquoteDecl}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6540}{\htmlId{6540}{\htmlClass{Function}{\text{Show-VDeleg}}}}\, \,\htmlId{6552}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Tactic.Derive.Show.html#2038}{\htmlId{6554}{\htmlClass{Function}{\text{derive-Show}}}}\, \,\href{Data.List.Base.html#4907}{\htmlId{6566}{\htmlClass{Function Operator}{\text{[}}}}\, \,\htmlId{6568}{\htmlClass{Symbol}{\text{(}}}\,\,\htmlId{6569}{\htmlClass{Keyword}{\text{quote}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#2570}{\htmlId{6575}{\htmlClass{Datatype}{\text{VDeleg}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6540}{\htmlId{6584}{\htmlClass{Function}{\text{Show-VDeleg}}}}\,\,\htmlId{6595}{\htmlClass{Symbol}{\text{)}}}\, \,\href{Data.List.Base.html#4907}{\htmlId{6597}{\htmlClass{Function Operator}{\text{]}}}}\,


\,\href{Ledger.Conway.Specification.Gov.Actions.html#6601}{\htmlId{6601}{\htmlClass{Function}{\text{isGovVoterDRep}}}}\, \,\htmlId{6616}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#2082}{\htmlId{6618}{\htmlClass{Record}{\text{GovVoter}}}}\, \,\htmlId{6627}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Agda.Builtin.Maybe.html#135}{\htmlId{6629}{\htmlClass{Datatype}{\text{Maybe}}}}\, \,\href{Ledger.Core.Specification.Address.html#259}{\htmlId{6635}{\htmlClass{Datatype}{\text{Credential}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#6601}{\htmlId{6646}{\htmlClass{Function}{\text{isGovVoterDRep}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#372}{\htmlId{6663}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6670}{\htmlId{6670}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \,\htmlId{6676}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Agda.Builtin.Maybe.html#173}{\htmlId{6678}{\htmlClass{InductiveConstructor}{\text{just}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6670}{\htmlId{6683}{\htmlClass{Bound}{\text{c}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#6601}{\htmlId{6685}{\htmlClass{CatchallClause Function}{\text{isGovVoterDRep}}}}\,\,\htmlId{6699}{\htmlClass{CatchallClause}{\text{ }}}\,\,\htmlId{6700}{\htmlClass{CatchallClause Symbol}{\text{\_}}}\, \,\htmlId{6702}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Agda.Builtin.Maybe.html#194}{\htmlId{6704}{\htmlClass{InductiveConstructor}{\text{nothing}}}}\,

\,\href{Ledger.Conway.Specification.Gov.Actions.html#6713}{\htmlId{6713}{\htmlClass{Function}{\text{isGovVoterCredential}}}}\, \,\htmlId{6734}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#2082}{\htmlId{6736}{\htmlClass{Record}{\text{GovVoter}}}}\, \,\htmlId{6745}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Agda.Builtin.Maybe.html#135}{\htmlId{6747}{\htmlClass{Datatype}{\text{Maybe}}}}\, \,\href{Ledger.Core.Specification.Address.html#259}{\htmlId{6753}{\htmlClass{Datatype}{\text{Credential}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#6713}{\htmlId{6764}{\htmlClass{Function}{\text{isGovVoterCredential}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#369}{\htmlId{6787}{\htmlClass{InductiveConstructor}{\text{CC}}}}\,   , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6794}{\htmlId{6794}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \,\htmlId{6800}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Agda.Builtin.Maybe.html#173}{\htmlId{6802}{\htmlClass{InductiveConstructor}{\text{just}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6794}{\htmlId{6807}{\htmlClass{Bound}{\text{c}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#6713}{\htmlId{6809}{\htmlClass{Function}{\text{isGovVoterCredential}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#372}{\htmlId{6832}{\htmlClass{InductiveConstructor}{\text{DRep}}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#6839}{\htmlId{6839}{\htmlClass{Bound}{\text{c}}}}\, \end{pmatrix} \,\htmlId{6845}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Agda.Builtin.Maybe.html#173}{\htmlId{6847}{\htmlClass{InductiveConstructor}{\text{just}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6839}{\htmlId{6852}{\htmlClass{Bound}{\text{c}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#6713}{\htmlId{6854}{\htmlClass{CatchallClause Function}{\text{isGovVoterCredential}}}}\,\,\htmlId{6874}{\htmlClass{CatchallClause}{\text{ }}}\,\,\htmlId{6875}{\htmlClass{CatchallClause Symbol}{\text{\_}}}\, \,\htmlId{6877}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Agda.Builtin.Maybe.html#194}{\htmlId{6879}{\htmlClass{InductiveConstructor}{\text{nothing}}}}\,

\,\href{Ledger.Conway.Specification.Gov.Actions.html#6888}{\htmlId{6888}{\htmlClass{Function}{\text{proposedCC}}}}\, \,\htmlId{6899}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#1454}{\htmlId{6901}{\htmlClass{Record}{\text{GovAction}}}}\, \,\htmlId{6911}{\htmlClass{Symbol}{\text{→}}}\, \,\href{abstract-set-theory.FiniteSetTheory.html#488}{\htmlId{6913}{\htmlClass{Function Operator}{\text{ℙ}}}}\, \,\href{Ledger.Core.Specification.Address.html#259}{\htmlId{6915}{\htmlClass{Datatype}{\text{Credential}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#6888}{\htmlId{6926}{\htmlClass{Function}{\text{proposedCC}}}}\, \begin{pmatrix} \,\href{Ledger.Conway.Specification.Gov.Actions.html#694}{\htmlId{6939}{\htmlClass{InductiveConstructor}{\text{UpdateCommittee}}}}\, , \,\htmlId{6957}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Conway.Specification.Gov.Actions.html#6958}{\htmlId{6958}{\htmlClass{Bound}{\text{x}}}}\, , \,\htmlId{6962}{\htmlClass{Symbol}{\text{\_}}}\, , \,\htmlId{6966}{\htmlClass{Symbol}{\text{\_)}}}\, \end{pmatrix} \,\htmlId{6973}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Class.IsSet.html#916}{\htmlId{6975}{\htmlClass{Function}{\text{dom}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#6958}{\htmlId{6979}{\htmlClass{Bound}{\text{x}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#6888}{\htmlId{6981}{\htmlClass{CatchallClause Function}{\text{proposedCC}}}}\,\,\htmlId{6991}{\htmlClass{CatchallClause}{\text{ }}}\,\,\htmlId{6992}{\htmlClass{CatchallClause Symbol}{\text{\_}}}\, \,\htmlId{6994}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Class.HasEmptySet.html#287}{\htmlId{6996}{\htmlClass{Field}{\text{∅}}}}\,


\,\href{Ledger.Conway.Specification.Gov.Actions.html#7000}{\htmlId{7000}{\htmlClass{Function}{\text{DReps}}}}\, \,\htmlId{7006}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Agda.Primitive.html#388}{\htmlId{7008}{\htmlClass{Primitive}{\text{Type}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#7000}{\htmlId{7013}{\htmlClass{Function}{\text{DReps}}}}\, \,\htmlId{7019}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Ledger.Core.Specification.Address.html#259}{\htmlId{7021}{\htmlClass{Datatype}{\text{Credential}}}}\, \,\href{abstract-set-theory.FiniteSetTheory.html#633}{\htmlId{7032}{\htmlClass{Function Operator}{\text{⇀}}}}\, \,\href{Ledger.Core.Specification.Epoch.html#646}{\htmlId{7034}{\htmlClass{Function}{\text{Epoch}}}}\,


\,\htmlId{7042}{\htmlClass{Keyword}{\text{record}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7049}{\htmlId{7049}{\htmlClass{Record}{\text{HasDReps}}}}\, \,\htmlId{7058}{\htmlClass{Symbol}{\text{{}}}\,\,\href{Ledger.Conway.Specification.Gov.Actions.html#7059}{\htmlId{7059}{\htmlClass{Bound}{\text{a}}}}\,\,\htmlId{7060}{\htmlClass{Symbol}{\text{}}}}\, \,\htmlId{7062}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Conway.Specification.Gov.Actions.html#7063}{\htmlId{7063}{\htmlClass{Bound}{\text{A}}}}\, \,\htmlId{7065}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Agda.Primitive.html#388}{\htmlId{7067}{\htmlClass{Primitive}{\text{Type}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7059}{\htmlId{7072}{\htmlClass{Bound}{\text{a}}}}\,\,\htmlId{7073}{\htmlClass{Symbol}{\text{)}}}\, \,\htmlId{7075}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Agda.Primitive.html#388}{\htmlId{7077}{\htmlClass{Primitive}{\text{Type}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7059}{\htmlId{7082}{\htmlClass{Bound}{\text{a}}}}\, \,\htmlId{7084}{\htmlClass{Keyword}{\text{where}}}\,
  \,\htmlId{7092}{\htmlClass{Keyword}{\text{field}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7098}{\htmlId{7098}{\htmlClass{Field}{\text{DRepsOf}}}}\, \,\htmlId{7106}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7063}{\htmlId{7108}{\htmlClass{Bound}{\text{A}}}}\, \,\htmlId{7110}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7000}{\htmlId{7112}{\htmlClass{Function}{\text{DReps}}}}\,
\,\htmlId{7118}{\htmlClass{Keyword}{\text{open}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7049}{\htmlId{7123}{\htmlClass{Module}{\text{HasDReps}}}}\, \,\htmlId{7132}{\htmlClass{Symbol}{\text{⦃...⦄}}}\, \,\htmlId{7138}{\htmlClass{Keyword}{\text{public}}}\,


\,\href{Ledger.Conway.Specification.Gov.Actions.html#7147}{\htmlId{7147}{\htmlClass{Function}{\text{activeInEpoch}}}}\, \,\htmlId{7161}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Ledger.Core.Specification.Epoch.html#646}{\htmlId{7163}{\htmlClass{Function}{\text{Epoch}}}}\, \,\htmlId{7169}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Core.Specification.Address.html#259}{\htmlId{7171}{\htmlClass{Datatype}{\text{Credential}}}}\, \,\href{Data.Product.Base.html#1618}{\htmlId{7182}{\htmlClass{Function Operator}{\text{×}}}}\, \,\href{Ledger.Core.Specification.Epoch.html#646}{\htmlId{7184}{\htmlClass{Function}{\text{Epoch}}}}\, \,\htmlId{7190}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Agda.Primitive.html#388}{\htmlId{7192}{\htmlClass{Primitive}{\text{Type}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#7147}{\htmlId{7197}{\htmlClass{Function}{\text{activeInEpoch}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7211}{\htmlId{7211}{\htmlClass{Bound}{\text{e}}}}\, \,\htmlId{7213}{\htmlClass{Symbol}{\text{(\_}}}\, , \,\href{Ledger.Conway.Specification.Gov.Actions.html#7218}{\htmlId{7218}{\htmlClass{Bound}{\text{expEpoch}}}}\,\,\htmlId{7226}{\htmlClass{Symbol}{\text{)}}}\, \,\htmlId{7228}{\htmlClass{Symbol}{\text{=}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7211}{\htmlId{7230}{\htmlClass{Bound}{\text{e}}}}\, \,\href{Class.HasOrder.Core.html#613}{\htmlId{7232}{\htmlClass{Field Operator}{\text{≤}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7218}{\htmlId{7234}{\htmlClass{Bound}{\text{expEpoch}}}}\,

\,\href{Ledger.Conway.Specification.Gov.Actions.html#7244}{\htmlId{7244}{\htmlClass{Function}{\text{activeDRepsOf}}}}\, \,\htmlId{7258}{\htmlClass{Symbol}{\text{:}}}\, \,\htmlId{7260}{\htmlClass{Symbol}{\text{{}}}\,\,\href{Ledger.Conway.Specification.Gov.Actions.html#7261}{\htmlId{7261}{\htmlClass{Bound}{\text{A}}}}\, \,\htmlId{7263}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Agda.Primitive.html#388}{\htmlId{7265}{\htmlClass{Primitive}{\text{Type}}}}\,\,\htmlId{7269}{\htmlClass{Symbol}{\text{}}}}\, \,\htmlId{7271}{\htmlClass{Symbol}{\text{⦃}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7273}{\htmlId{7273}{\htmlClass{Bound}{\text{\_}}}}\, \,\htmlId{7275}{\htmlClass{Symbol}{\text{:}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7049}{\htmlId{7277}{\htmlClass{Record}{\text{HasDReps}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7261}{\htmlId{7286}{\htmlClass{Bound}{\text{A}}}}\, \,\htmlId{7288}{\htmlClass{Symbol}{\text{⦄}}}\, \,\htmlId{7290}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7261}{\htmlId{7292}{\htmlClass{Bound}{\text{A}}}}\, \,\htmlId{7294}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Core.Specification.Epoch.html#646}{\htmlId{7296}{\htmlClass{Function}{\text{Epoch}}}}\, \,\htmlId{7302}{\htmlClass{Symbol}{\text{→}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7000}{\htmlId{7304}{\htmlClass{Function}{\text{DReps}}}}\,
\,\href{Ledger.Conway.Specification.Gov.Actions.html#7244}{\htmlId{7310}{\htmlClass{Function}{\text{activeDRepsOf}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7324}{\htmlId{7324}{\htmlClass{Bound}{\text{a}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7326}{\htmlId{7326}{\htmlClass{Bound}{\text{e}}}}\, \,\htmlId{7328}{\htmlClass{Symbol}{\text{=}}}\, \,\href{abstract-set-theory.FiniteSetTheory.html#4102}{\htmlId{7330}{\htmlClass{Function}{\text{filterᵐ}}}}\, \,\htmlId{7338}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Conway.Specification.Gov.Actions.html#7147}{\htmlId{7339}{\htmlClass{Function}{\text{activeInEpoch}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7326}{\htmlId{7353}{\htmlClass{Bound}{\text{e}}}}\,\,\htmlId{7354}{\htmlClass{Symbol}{\text{)}}}\, \,\htmlId{7356}{\htmlClass{Symbol}{\text{(}}}\,\,\href{Ledger.Conway.Specification.Gov.Actions.html#7098}{\htmlId{7357}{\htmlClass{Field}{\text{DRepsOf}}}}\, \,\href{Ledger.Conway.Specification.Gov.Actions.html#7324}{\htmlId{7365}{\htmlClass{Bound}{\text{a}}}}\,\,\htmlId{7366}{\htmlClass{Symbol}{\text{)}}}\,