structure
GaudisCrypt.InductiveFunction
[ProgramSpec]
(t : Sort u_2)
:
Sort (max (max 2 (u_1 + 1)) u_2)
- nothing : t
- join : t → t → t
Instances For
class
GaudisCrypt.Reducible
[ProgramSpec]
{t : Type u_2}
(ind : InductiveFunction t)
extends Preorder t, Std.Commutative ind.join, Std.Associative ind.join :
Type u_2
- delta_bound {holes : HoleSigs} {sig : ProcedureSignature} (proc : ProcedureWithHoles holes sig) (args : holes.Instantiation) : ind.proc (proc.instantiate fun {sig : ProcedureSignature} => args) ≤ List.foldr (fun (p : (sig : ProcedureSignature) × Procedure sig) (acc : t) => ind.join (ind.proc p.snd) acc) (ind.proc proc) args.toList
Instances
def
GaudisCrypt.InductiveFunction.evalInstantiationFold
[ProgramSpec]
{t : Type u_2}
(ind : InductiveFunction t)
{holes : HoleSigs}
(inst : holes.Instantiation)
:
t
Evaluate an instantiation (a dependent tuple of procedures) by folding over the list
inst.toList.
This matches the evaluation of inst.toModuleTuple under evalMexpr (see
evalMexpr_toModuleTuple).
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
GaudisCrypt.InductiveFunction.evalMexpr
[ProgramSpec]
{t : Sort u_2}
(ind : InductiveFunction t)
(m : ModuleExpression)
:
t
Equations
- ind.evalMexpr (GaudisCrypt.ModuleExpression.proc p) = ind.proc p
- ind.evalMexpr (GaudisCrypt.ModuleExpression.procHoles a p) = ind.proc p
- ind.evalMexpr (GaudisCrypt.ModuleExpression.var a) = ind.nothing
- ind.evalMexpr (m_2.app n) = ind.join (ind.evalMexpr m_2) (ind.evalMexpr n)
- ind.evalMexpr m_2.fst = ind.evalMexpr m_2
- ind.evalMexpr m_2.snd = ind.evalMexpr m_2
- ind.evalMexpr m_2.abs = ind.evalMexpr m_2
- ind.evalMexpr (m_2.pair n) = ind.join (ind.evalMexpr m_2) (ind.evalMexpr n)
- ind.evalMexpr GaudisCrypt.ModuleExpression.unit = ind.nothing
Instances For
theorem
GaudisCrypt.InductiveFunction.evalMexpr_rename
[ProgramSpec]
{t : Type u_1}
(ind : InductiveFunction t)
(m : ModuleExpression)
(ρ : ℕ → ℕ)
:
theorem
GaudisCrypt.InductiveFunction.join_join_right_join_of_idem
[ProgramSpec]
{t : Type u_1}
(ind : InductiveFunction t)
[Reducible ind]
(join_idem : ∀ (x : t), ind.join x x ≤ x)
(x y e : t)
:
theorem
GaudisCrypt.InductiveFunction.evalMexpr_substituteSimultaneously_le
[ProgramSpec]
{t : Type u_1}
(ind : InductiveFunction t)
[Reducible ind]
(m : ModuleExpression)
(σ : ℕ → ModuleExpression)
(extra : t)
:
theorem
GaudisCrypt.InductiveFunction.evalMexpr_substitute_le
[ProgramSpec]
{t : Type u_1}
(ind : InductiveFunction t)
[Reducible ind]
(body arg : ModuleExpression)
:
def
GaudisCrypt.InductiveFunction.eval'
[ProgramSpec]
{t : Sort u_2}
{mt : ModuleTypeRep}
(ind : InductiveFunction t)
(m : Module mt)
:
t
Equations
- ind.eval' m = ind.evalMexpr m.expression
Instances For
def
GaudisCrypt.InductiveFunction.eval
[ProgramSpec]
{M : Type (max 1 u_1)}
{t : Sort u_2}
(ind : InductiveFunction t)
[i : IsModule M]
(m : M)
:
t
Equations
- ind.eval m = ind.eval' (GaudisCrypt.Module.cast M m)
Instances For
theorem
GaudisCrypt.InductiveFunction.evalMexpr_toModuleTuple
[ProgramSpec]
{t : Type u_1}
(ind : InductiveFunction t)
{holes : HoleSigs}
(inst : holes.Instantiation)
:
ind.evalMexpr (HoleSigs.Instantiation.toModuleExpr fun {sig : ProcedureSignature} => inst) = ind.evalInstantiationFold fun {sig : ProcedureSignature} => inst
theorem
GaudisCrypt.eval_induction_step
[ProgramSpec]
{t : Type u_1}
(ind : InductiveFunction t)
[Reducible ind]
{m m' : ModuleExpression}
(h : m.ReductionStep m')
:
theorem
GaudisCrypt.evalMexpr_reduce
[ProgramSpec]
{t : Type u_1}
(ind : InductiveFunction t)
[Reducible ind]
(m : ModuleExpression)
(h : m.Terminating)
:
theorem
GaudisCrypt.evalMexpr_upper_bound
[ProgramSpec]
{t : Type u_1}
{mt : ModuleTypeRep}
(ind : InductiveFunction t)
[Reducible ind]
{m : ModuleExpression}
(h : m.HasType [] mt)
:
theorem
GaudisCrypt.InductiveFunction.app_moduleExpression
[ProgramSpec]
{t : Sort u_1}
(ind : InductiveFunction t)
(a b : ModuleExpression)
:
theorem
GaudisCrypt.InductiveFunction.app'
[ProgramSpec]
{t : Type u_1}
{A B : ModuleTypeRep}
(ind : InductiveFunction t)
[Reducible ind]
(a : Module (A.arr B))
(b : Module A)
:
theorem
GaudisCrypt.InductiveFunction.app
[ProgramSpec]
{t : Type u_1}
{A B : Type (max 1 u_2)}
(ind : InductiveFunction t)
[Reducible ind]
[IsModule A]
[IsModule B]
(a : Module.Arr A B)
(b : A)
:
theorem
GaudisCrypt.InductiveFunction.pair_moduleExpression
[ProgramSpec]
{t : Sort u_1}
(ind : InductiveFunction t)
(a b : ModuleExpression)
:
theorem
GaudisCrypt.InductiveFunction.pair'
[ProgramSpec]
{t : Sort u_1}
{A B : ModuleTypeRep}
(ind : InductiveFunction t)
(a : Module A)
(b : Module B)
:
theorem
GaudisCrypt.InductiveFunction.pair
[ProgramSpec]
{t : Sort u_1}
{A B : Type (max 1 u_2)}
(ind : InductiveFunction t)
[IsModule A]
[IsModule B]
(a : A)
(b : B)
:
@[simp]
theorem
GaudisCrypt.InductiveFunction.fst_moduleExpression
[ProgramSpec]
{t : Sort u_1}
(ind : InductiveFunction t)
(a : ModuleExpression)
:
theorem
GaudisCrypt.InductiveFunction.fst'
[ProgramSpec]
{t : Type u_1}
{A B : ModuleTypeRep}
(ind : InductiveFunction t)
[Reducible ind]
(a : Module (A.prod B))
:
theorem
GaudisCrypt.InductiveFunction.fst
[ProgramSpec]
{t : Type u_1}
{A B : Type (max 1 u_2)}
(ind : InductiveFunction t)
[Reducible ind]
[IsModule A]
[IsModule B]
(a : Module.Prod A B)
:
@[simp]
theorem
GaudisCrypt.InductiveFunction.snd_moduleExpression
[ProgramSpec]
{t : Sort u_1}
(ind : InductiveFunction t)
(a : ModuleExpression)
:
theorem
GaudisCrypt.InductiveFunction.snd'
[ProgramSpec]
{t : Type u_1}
{A B : ModuleTypeRep}
(ind : InductiveFunction t)
[Reducible ind]
(a : Module (A.prod B))
:
theorem
GaudisCrypt.InductiveFunction.snd
[ProgramSpec]
{t : Type u_1}
{A B : Type (max 1 u_2)}
(ind : InductiveFunction t)
[Reducible ind]
[IsModule A]
[IsModule B]
(a : Module.Prod A B)
:
@[simp]
theorem
GaudisCrypt.InductiveFunction.unit_moduleExpression
[ProgramSpec]
{t : Sort u_1}
(ind : InductiveFunction t)
:
@[simp]
theorem
GaudisCrypt.InductiveFunction.unit
[ProgramSpec]
{t : Sort u_1}
(ind : InductiveFunction t)
(m : Module ModuleTypeRep.unit)
:
Instances For
def
GaudisCrypt.InductiveFunctionGettersSetters.transfer
[ProgramSpec]
{T : Type → Type}
{s t : Type}
(ind : InductiveFunctionGettersSetters T)
(x : T (ProcedureState s))
:
T (ProcedureState t)
Equations
- ind.transfer x = ind.extend GaudisCrypt.ProcedureState.globalL (ind.reduce GaudisCrypt.ProcedureState.globalL x)
Instances For
def
GaudisCrypt.InductiveFunctionGettersSetters.stmt
[ProgramSpec]
{T : Type → Type}
(ind : InductiveFunctionGettersSetters T)
{s : Type}
{holes : HoleSigs}
:
StmtWithHoles holes s → T (ProcedureState s)
Equations
- ind.stmt GaudisCrypt.StmtWithHoles.skip = ind.nothing
- ind.stmt (GaudisCrypt.StmtWithHoles.sample x_1 e) = ind.join (ind.setter x_1) (ind.getter e)
- ind.stmt (GaudisCrypt.StmtWithHoles.call' x_1 locals b r p) = ind.join (ind.setter x_1) (ind.join (ind.transfer (ind.stmt b)) (ind.join (ind.transfer (ind.getter r)) (ind.getter p)))
- ind.stmt (GaudisCrypt.StmtWithHoles.hole n x_1 p) = ind.join (ind.setter x_1) (ind.getter p)
- ind.stmt (s1.seq s2) = ind.join (ind.stmt s1) (ind.stmt s2)
- ind.stmt (GaudisCrypt.StmtWithHoles.ifThenElse c t e) = ind.join (ind.getter c) (ind.join (ind.stmt t) (ind.stmt e))
- ind.stmt (GaudisCrypt.StmtWithHoles.while c t) = ind.join (ind.getter c) (ind.stmt t)
Instances For
def
GaudisCrypt.InductiveFunctionGettersSetters.proc
[ProgramSpec]
{T : Type → Type}
(ind : InductiveFunctionGettersSetters T)
{sig : ProcedureSignature}
{holes : HoleSigs}
(proc : ProcedureWithHoles holes sig)
:
T State
Equations
- ind.proc proc = ind.join (ind.reduce GaudisCrypt.ProcedureState.globalL (ind.stmt proc.body)) (ind.reduce GaudisCrypt.ProcedureState.globalL (ind.getter proc.return_val))
Instances For
class
GaudisCrypt.ReducibleGettersSetters
{T : Type → Type}
(ind : InductiveFunctionGettersSetters T)
:
Type 1
- comm {t : Type} : Std.Commutative ind.join
- assoc {t : Type} : Std.Associative ind.join
- reduce_mono {a b : Type} {r₁ r₂ : T b} (lens : Lens a b) : r₁ ≤ r₂ → ind.reduce lens r₁ ≤ ind.reduce lens r₂
Monotonicity of
reduce. Under only aPreorderthis is not derivable fromreduce_join(the old derivation used antisymmetry to turnr₁ ≤ r₂intojoin r₁ r₂ = r₂). - extend_mono {a b : Type} {r₁ r₂ : T a} (lens : Lens a b) : r₁ ≤ r₂ → ind.extend lens r₁ ≤ ind.extend lens r₂
Monotonicity of
extend; seereduce_mono.
Instances
def
GaudisCrypt.InductiveFunctionGettersSetters.inductiveFunction
[ProgramSpec]
{T : Type → Type}
(ind : InductiveFunctionGettersSetters T)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
GaudisCrypt.InductiveFunctionGettersSetters.evalMexpr
[ProgramSpec]
{T : Type → Type}
(ind : InductiveFunctionGettersSetters T)
:
Equations
- ind.evalMexpr = ind.inductiveFunction.evalMexpr
Instances For
def
GaudisCrypt.InductiveFunctionGettersSetters.eval'
[ProgramSpec]
{T : Type → Type}
{t : ModuleTypeRep}
(ind : InductiveFunctionGettersSetters T)
:
Equations
- ind.eval' = ind.inductiveFunction.eval'
Instances For
def
GaudisCrypt.InductiveFunctionGettersSetters.eval
[ProgramSpec]
{T : Type → Type}
{M : Type 1}
(ind : InductiveFunctionGettersSetters T)
[IsModule M]
:
M → T State
Equations
- ind.eval = ind.inductiveFunction.eval
Instances For
@[implicit_reducible]
instance
GaudisCrypt.instReducibleStateInductiveFunctionOfReducibleGettersSetters
[ProgramSpec]
{T : Type → Type}
{ind : InductiveFunctionGettersSetters T}
[red : ReducibleGettersSetters ind]
:
Equations
- One or more equations did not get rendered due to their size.