Computational Inductive Relations #
Here we define the notion of Computational Relations as relations that have functions realizing/computing them. In other words, functions computing the same related states.
References #
See [Ledger.FMBC2024] for a formal presentation of the idea?
We represent computations using failing computations. A computation succeeds, returning a value, or fails, returning an error.
- Success {Err R : Type} : R → ComputationResult Err R
- Failure {Err R : Type} : Err → ComputationResult Err R
Instances For
Equations
- instReprComputationResult = { reprPrec := instReprComputationResult.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
We can just forget what error computations return.
Equations
Instances For
Because we use Plausible to quickcheck some properties, we need to have a way to show computation results in the screen.
Equations
- One or more equations did not get rendered due to their size.
Failing computation with no error.
Equations
Instances For
Succeeding computation.
Equations
Instances For
Failing computation with a given error.
Equations
Instances For
Equations
- fromOptionWith' e c = fromOptionWith c e
Instances For
Checking if a result is successful.
Equations
Instances For
Getting errors if computation fails.
Equations
Instances For
Computation Result is a functor
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- bimap em rm (ComputationResult.Success a) = ComputationResult.Success (rm a)
- bimap em rm (ComputationResult.Failure a) = ComputationResult.Failure (em a)
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- instMonadComputationResult = { toApplicative := instApplicativeComputationResult, toBind := instBindComputationResult }
Equations
Instances For
- compute : Env → In → State → ComputationResult Err State
- correct (e : Env) (i : In) (s s' : State) : self.compute e i s = ComputationResult.Success s' ↔ Rel e i s s'
Instances For
Composition of State Machines #
This is not very sophisticated composition, it just matches our needs in this project. If we eventually detect this is a good pattern, we can write a library around this. In IOG, Andre Knispel is writing a framework Categorical Crytpo taking ideas like this to the next level.
To keep composition clean, we assume there is a parameter global shared set of
parameters GP.
Ideally, users may choose shared parameters and put them in this GP type, but
it is not mandatory.
Each machine has their own set of parameters, states and actions.
For flexibility, we may assume that they may compute something different than
their states.
Product Composition. Tensor Product.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- CompositionAndOps.conditional_sub m lift gp p s a = match lift s a with | some na => ComputationResult.merr some (m gp p s na) | none => failWith none
Instances For
Equations
- One or more equations did not get rendered due to their size.