@[reducible, inline]
Equations
Instances For
- funs : Bytes.Function BytesWellFormedT
Instances
def
DY.Bytes.WellFormed
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
(b : Bytes)
:
Equations
Instances For
class
DY.BytesWellFormed.Has
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
(binv : outParam (Bytes.PartialFunction SubF BytesWellFormedT))
:
- pf : Bytes.SubFunction binv funs
Instances
@[simp]
theorem
DY.Bytes.WellFormed.eq
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
[BytesWellFormed]
{binv : PartialFunction SubF BytesWellFormedT}
[tc : BytesWellFormed.Has binv]
(b : BytesView SubF)
(tr : ProofTrace)
:
b.pack.WellFormed tr = binv b (fun (y : Bytes) (x : sizeOf y ≤ ALaCarte.FunctorSizeOf.sizeOf b) => y.WellFormed) tr
Equations
- DY.BytesWellFormedLaterT bwf = ∀ (tr1 tr2 : DY.ProofTrace), tr1 ≤ tr2 → bwf tr1 → bwf tr2
Instances For
Instances
theorem
DY.Bytes.WellFormed.later
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[BytesWellFormedLater]
(b : Bytes)
(tr1 tr2 : ProofTrace)
:
tr1 ≤ tr2 → b.WellFormed tr1 → b.WellFormed tr2
Equations
- DY.Usage.nothing = { type := "", tag := "", data := none }
Instances For
@[reducible, inline]
Equations
Instances For
- funs : Bytes.Function GetUsageT
Instances
Equations
Instances For
class
DY.GetUsage.Has
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[GetUsage]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
(binv : outParam (Bytes.PartialFunction SubF GetUsageT))
:
- pf : Bytes.SubFunction binv funs
Instances
@[simp]
theorem
DY.Bytes.usage.eq
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
[GetUsage]
{binv : PartialFunction SubF GetUsageT}
[tc : GetUsage.Has binv]
(b : BytesView SubF)
(tr : ProofTrace)
:
def
DY.GetUsageLaterT
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
(x : BytesWellFormedT × GetUsageT)
:
Equations
- DY.GetUsageLaterT (wf, usg) = ∀ (tr1 tr2 : DY.ProofTrace), tr1 ≤ tr2 → wf tr1 → usg tr1 = usg tr2
Instances For
class
DY.GetUsageLater
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[GetUsage]
:
Instances
theorem
DY.Bytes.usage_later
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[GetUsage]
[GetUsageLater]
(b : Bytes)
(tr1 tr2 : ProofTrace)
:
tr1 ≤ tr2 → b.WellFormed tr1 → b.usage tr1 = b.usage tr2
@[reducible, inline]
Equations
Instances For
- funs : Bytes.Function GetLabelT
Instances
Equations
Instances For
class
DY.GetLabel.Has
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[GetLabel]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
(binv : outParam (Bytes.PartialFunction SubF GetLabelT))
:
- pf : Bytes.SubFunction binv funs
Instances
@[simp]
theorem
DY.Bytes.label.eq
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
[GetLabel]
{binv : PartialFunction SubF GetLabelT}
[tc : GetLabel.Has binv]
(b : BytesView SubF)
(tr : ProofTrace)
:
Equations
- DY.GetLabelLaterT (wf, usg) = ∀ (tr1 tr2 : DY.ProofTrace), tr1 ≤ tr2 → wf tr1 → usg tr1 = usg tr2
Instances For
class
DY.GetLabelLater
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[GetLabel]
:
Instances
theorem
DY.Bytes.label_later
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[GetLabel]
[GetLabelLater]
(b : Bytes)
(tr1 tr2 : ProofTrace)
:
tr1 ≤ tr2 → b.WellFormed tr1 → b.label tr1 = b.label tr2
@[reducible, inline]
Equations
Instances For
- funs : Bytes.Function BytesInvariantT
Instances
def
DY.Bytes.Invariant
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariant]
(b : Bytes)
(tr : ProofTrace)
:
Equations
- b.Invariant tr = DY.Bytes.rec DY.BytesInvariant.funs b tr
Instances For
class
DY.BytesInvariant.Has
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariant]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
(binv : outParam (Bytes.PartialFunction SubF BytesInvariantT))
:
- pf : Bytes.SubFunction binv funs
Instances
@[simp]
theorem
DY.Bytes.Invariant.eq
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
[BytesInvariant]
{binv : PartialFunction SubF BytesInvariantT}
[tc : BytesInvariant.Has binv]
(b : BytesView SubF)
(tr : ProofTrace)
:
def
DY.BytesInvariantImpliesBytesWellFormedT
[ExecTraceTypes]
[ProofTraceTypes]
(x : BytesInvariantT × BytesWellFormedT)
:
Equations
- DY.BytesInvariantImpliesBytesWellFormedT (binv, bwf) = ∀ (tr : DY.ProofTrace), binv tr → bwf tr
Instances For
theorem
DY.Bytes.Invariant_implies_WellFormed
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[BytesInvariant]
[BytesInvariantImpliesBytesWellFormed]
(b : Bytes)
(tr : ProofTrace)
:
b.Invariant tr → b.WellFormed tr
Equations
- DY.BytesInvariantLaterT binv = ∀ (tr1 tr2 : DY.ProofTrace), tr1 ≤ tr2 → binv tr1 → binv tr2
Instances For
Instances
theorem
DY.Bytes.Invariant.later
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariant]
[BytesInvariantLater]
(b : Bytes)
(tr1 tr2 : ProofTrace)
:
structure
DY.Bytes.PartialInvariants
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
(SubF : Type → Type)
[SubBytesFunctor SubF]
:
To reduce the boilerplate required to combine all (sub-)invariants,
we bundle them into this structure,
so that instead of having to combine each function separately,
we can simply combine this bundle of functions.
However, such a bundling prevents
e.g. the definition of invariant to assume that
well_formed is constructed in some particular way
(e.g. that it contains some Pk invariants).
Later on we will define properties on these (sub-)invariants:
we do not bundle them here because in these proofs
we want to be able to assume a particular implementation of well_formed.
- well_formed : PartialFunction SubF BytesWellFormedT
- usage : PartialFunction SubF GetUsageT
- label [GetUsage] : PartialFunction SubF GetLabelT
Instances For
- invs : Bytes.PartialInvariants BytesF
Instances
@[instance_reducible]
instance
DY.instBytesWellFormedOfBytesInvariants
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
:
Equations
@[instance_reducible]
instance
DY.instGetUsageOfBytesInvariants
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
:
Equations
@[instance_reducible]
instance
DY.instGetLabelOfBytesInvariants
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
:
Equations
@[instance_reducible]
instance
DY.instBytesInvariantOfBytesInvariants
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
:
Equations
structure
DY.Bytes.PartialInvariantsProofs
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{SubF : Type → Type}
[SubBytesFunctor SubF]
(invs : PartialInvariants SubF)
:
- well_formed_later : PartialProof1 invs.well_formed WellFormed BytesWellFormedLaterT
- usage_later : PartialProof2 invs.well_formed invs.usage WellFormed usage GetUsageLaterT
- label_later [GetUsageLater] : PartialProof2 invs.well_formed invs.label WellFormed label GetLabelLaterT
- invariant_implies_wellformed : PartialProof2 invs.invariant invs.well_formed Invariant WellFormed BytesInvariantImpliesBytesWellFormedT
- invariant_later [BytesWellFormedLater] [GetUsageLater] [GetLabelLater] [BytesInvariantImpliesBytesWellFormed] : PartialProof1 invs.invariant Invariant BytesInvariantLaterT
Instances For
class
DY.BytesInvariantsProofs
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
:
Instances
class
DY.BytesInvariants.HasStep
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{SubF1 SubF2 : Type → Type}
[SubBytesFunctor SubF1]
[SubBytesFunctor SubF2]
[BytesFunctor.HasStep SubF1 SubF2]
(partialInvs1 : outParam (Bytes.PartialInvariants SubF1))
(partialInvs2 : Bytes.PartialInvariants SubF2)
:
- well_formed_sub : Bytes.SubFunctionStep partialInvs1.well_formed partialInvs2.well_formed
- usage_sub : Bytes.SubFunctionStep partialInvs1.usage partialInvs2.usage
- label_sub : Bytes.SubFunctionStep partialInvs1.label partialInvs2.label
- invariant_sub : Bytes.SubFunctionStep partialInvs1.invariant partialInvs2.invariant
Instances
class
DY.BytesInvariants.Has
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
(partialInvs : outParam (Bytes.PartialInvariants SubF))
:
- well_formed_sub : Bytes.SubFunction partialInvs.well_formed BytesWellFormed.funs
- usage_sub : Bytes.SubFunction partialInvs.usage GetUsage.funs
- label_sub : Bytes.SubFunction partialInvs.label GetLabel.funs
- invariant_sub : Bytes.SubFunction partialInvs.invariant BytesInvariant.funs
Instances
def
DY.Bytes.PartialInvariants.combine
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
{t : Type}
[DecidableEq t]
[Ord t]
[Std.LawfulEqOrd t]
[Std.TransOrd t]
{SubFs : t → Type → Type}
[(id : t) → SubBytesFunctor (SubFs id)]
(invs : (id : t) → PartialInvariants (SubFs id))
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
DY.Bytes.PartialInvariantsProofs.combine
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{t : Type}
[DecidableEq t]
[Ord t]
[Std.LawfulEqOrd t]
[Std.TransOrd t]
{SubFs : t → Type → Type}
[(id : t) → SubBytesFunctor (SubFs id)]
{invs : (id : t) → PartialInvariants (SubFs id)}
(pfs : ∀ (id : t), PartialInvariantsProofs (invs id))
:
instance
DY.BytesInvariants.instHasOfHasStep
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{SubF1 SubF2 : Type → Type}
[SubBytesFunctor SubF1]
[SubBytesFunctor SubF2]
[BytesFunctor.HasStep SubF1 SubF2]
[BytesFunctor.Has SubF2]
(partialInvs1 : Bytes.PartialInvariants SubF1)
(partialInvs2 : Bytes.PartialInvariants SubF2)
[inst1 : HasStep partialInvs1 partialInvs2]
[inst2 : Has partialInvs2]
:
Has partialInvs1
instance
DY.BytesInvariants.instHasStepCombineCombine
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{t : Type}
[DecidableEq t]
[Ord t]
[Std.LawfulEqOrd t]
[Std.TransOrd t]
(SubFs : t → Type → Type)
[(id : t) → SubBytesFunctor (SubFs id)]
(invs : (id : t) → Bytes.PartialInvariants (SubFs id))
(id : t)
:
HasStep (invs id) (Bytes.PartialInvariants.combine invs)
instance
DY.BytesInvariants.instHasWell_formedOfHas
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
(invs : Bytes.PartialInvariants SubF)
[tc : Has invs]
:
instance
DY.BytesInvariants.instHasUsageOfHas
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
(invs : Bytes.PartialInvariants SubF)
[tc : Has invs]
:
GetUsage.Has invs.usage
instance
DY.BytesInvariants.instHasLabelOfHas
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
(invs : Bytes.PartialInvariants SubF)
[tc : Has invs]
:
GetLabel.Has invs.label
instance
DY.BytesInvariants.instHasInvariantOfHas
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
{SubF : Type → Type}
[SubBytesFunctor SubF]
[BytesFunctor.Has SubF]
(invs : Bytes.PartialInvariants SubF)
[tc : Has invs]
:
def
DY.Bytes.Publishable
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
(b : Bytes)
(tr : ProofTrace)
:
Equations
- b.Publishable tr = (b.Invariant tr ∧ (b.label tr).canFlow DY.Label.pub (DY.Trace.erase tr))
Instances For
def
DY.Bytes.KnowableBy
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
(l : Label)
(b : Bytes)
(tr : ProofTrace)
:
Equations
- DY.Bytes.KnowableBy l b tr = (b.Invariant tr ∧ (b.label tr).canFlow l (DY.Trace.erase tr))
Instances For
def
DY.Bytes.HasUsage
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[GetUsage]
[GetLabel]
(b : Bytes)
(usg : Usage)
(tr : ProofTrace)
:
Equations
- b.HasUsage usg tr = (b.usage tr = usg ∨ (b.label tr).canFlow DY.Label.pub (DY.Trace.erase tr))
Instances For
theorem
DY.Bytes.HasUsage_later
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[GetUsage]
[GetUsageLater]
[GetLabel]
[GetLabelLater]
(b : Bytes)
(usg : Usage)
(tr1 tr2 : ProofTrace)
:
b.WellFormed tr1 → tr1 ≤ tr2 → b.HasUsage usg tr1 → b.HasUsage usg tr2
theorem
DY.Bytes.HasUsage_inj
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[GetUsage]
[GetLabel]
(b : Bytes)
(usg1 usg2 : Usage)
(tr : ProofTrace)
:
theorem
DY.Bytes.HasUsage_public
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[GetUsage]
[GetLabel]
(b : Bytes)
(usg : Usage)
(tr : ProofTrace)
:
(b.label tr).canFlow Label.pub (Trace.erase tr) → b.HasUsage usg tr
def
DY.Bytes.xxxLabel
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[GetLabel]
(extract : Bytes → Option Bytes)
(b : Bytes)
(tr : ProofTrace)
:
Equations
- DY.Bytes.xxxLabel extract b tr = match extract b with | some sk => sk.label tr | none => DY.Label.pub
Instances For
def
DY.Bytes.XXXHasUsage
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[GetUsage]
[GetLabel]
(extract : Bytes → Option Bytes)
(b : Bytes)
(usg : Usage)
(tr : ProofTrace)
:
Equations
Instances For
def
DY.ExtractPreservesWellFormed
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
(extract : Bytes → Option Bytes)
:
Equations
- DY.ExtractPreservesWellFormed extract = ∀ (b : DY.Bytes) (tr : DY.ProofTrace), b.WellFormed tr → match extract b with | some b' => b'.WellFormed tr | none => True
Instances For
theorem
DY.Bytes.xxxLabel_later
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[GetLabel]
[GetLabelLater]
(extract : Bytes → Option Bytes)
(h_extract : ExtractPreservesWellFormed extract)
(b : Bytes)
(tr1 tr2 : ProofTrace)
:
b.WellFormed tr1 → tr1 ≤ tr2 → xxxLabel extract b tr1 = xxxLabel extract b tr2
theorem
DY.Bytes.XXXHasUsage_later
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesWellFormed]
[GetUsage]
[GetUsageLater]
[GetLabel]
[GetLabelLater]
(extract : Bytes → Option Bytes)
(h_extract : ExtractPreservesWellFormed extract)
(b : Bytes)
(usg : Usage)
(tr1 tr2 : ProofTrace)
:
b.WellFormed tr1 → tr1 ≤ tr2 → XXXHasUsage extract b usg tr1 → XXXHasUsage extract b usg tr2
theorem
DY.Bytes.usage_later_fast
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
[BytesInvariantsProofs]
(b : Bytes)
(tr1 tr2 : ProofTrace)
:
theorem
DY.Bytes.label_later_fast
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
[BytesInvariantsProofs]
(b : Bytes)
(tr1 tr2 : ProofTrace)
:
theorem
DY.Bytes.Invariant.later_fast
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
[BytesInvariantsProofs]
(b : Bytes)
(tr1 tr2 : ProofTrace)
:
theorem
DY.Bytes.Publishable_later_fast
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
[BytesInvariantsProofs]
(b : Bytes)
(tr1 tr2 : ProofTrace)
:
tr1 ≤ tr2 → b.Publishable tr1 → b.Publishable tr2
theorem
DY.Bytes.Publishable_imp_Invariant_fast
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
[BytesInvariantsProofs]
(b : Bytes)
(tr : ProofTrace)
:
b.Publishable tr → b.Invariant tr
theorem
DY.Bytes.HasUsage_later_fast
[BytesFunctor]
[ExecTraceTypes]
[ProofTraceTypes]
[BytesInvariants]
[BytesInvariantsProofs]
(b : Bytes)
(usg : Usage)
(tr1 tr2 : ProofTrace)
: