Documentation

Cedar.Thm.Validation.Typechecker.Call

This file proves that typechecking of .call expressions is sound.

theorem Cedar.Thm.type_of_call_decimal_comparator_is_sound {xfn : Spec.ExtFun} {xs : List Spec.Expr} {c₁ c₂ : Validation.Capabilities} {env : Validation.TypeEnv} {ty : Validation.TypedExpr} {request : Spec.Request} {entities : Spec.Entities} (h₀ : IsDecimalComparator xfn) (h₁ : CapabilitiesInvariant c₁ request entities) (h₂ : InstanceOfWellFormedEnvironment request entities env) (h₃ : Validation.typeOf (Spec.Expr.call xfn xs) c₁ env = Except.ok (ty, c₂)) (ih : ∀ (xᵢ : Spec.Expr), xᵢ xsTypeOfIsSound xᵢ) :
GuardedCapabilitiesInvariant (Spec.Expr.call xfn xs) c₂ request entities (v : Spec.Value), EvaluatesTo (Spec.Expr.call xfn xs) request entities v InstanceOfType env v ty.typeOf
theorem Cedar.Thm.type_of_call_toTime_is_sound {xs : List Spec.Expr} {c₁ c₂ : Validation.Capabilities} {env : Validation.TypeEnv} {ty : Validation.TypedExpr} {request : Spec.Request} {entities : Spec.Entities} (h₁ : CapabilitiesInvariant c₁ request entities) (h₂ : InstanceOfWellFormedEnvironment request entities env) (h₃ : Validation.typeOf (Spec.Expr.call Spec.ExtFun.toTime xs) c₁ env = Except.ok (ty, c₂)) (ih : ∀ (xᵢ : Spec.Expr), xᵢ xsTypeOfIsSound xᵢ) :
theorem Cedar.Thm.type_of_call_toDate_is_sound {xs : List Spec.Expr} {c₁ c₂ : Validation.Capabilities} {env : Validation.TypeEnv} {ty : Validation.TypedExpr} {request : Spec.Request} {entities : Spec.Entities} (h₁ : CapabilitiesInvariant c₁ request entities) (h₂ : InstanceOfWellFormedEnvironment request entities env) (h₃ : Validation.typeOf (Spec.Expr.call Spec.ExtFun.toDate xs) c₁ env = Except.ok (ty, c₂)) (ih : ∀ (xᵢ : Spec.Expr), xᵢ xsTypeOfIsSound xᵢ) :
theorem Cedar.Thm.type_of_call_offset_is_sound {xs : List Spec.Expr} {c₁ c₂ : Validation.Capabilities} {env : Validation.TypeEnv} {ty : Validation.TypedExpr} {request : Spec.Request} {entities : Spec.Entities} (h₁ : CapabilitiesInvariant c₁ request entities) (h₂ : InstanceOfWellFormedEnvironment request entities env) (h₃ : Validation.typeOf (Spec.Expr.call Spec.ExtFun.offset xs) c₁ env = Except.ok (ty, c₂)) (ih : ∀ (xᵢ : Spec.Expr), xᵢ xsTypeOfIsSound xᵢ) :
theorem Cedar.Thm.type_of_call_ipAddr_recognizer_is_sound {xfn : Spec.ExtFun} {xs : List Spec.Expr} {c₁ c₂ : Validation.Capabilities} {env : Validation.TypeEnv} {ty : Validation.TypedExpr} {request : Spec.Request} {entities : Spec.Entities} (h₀ : IsIpAddrRecognizer xfn) (h₁ : CapabilitiesInvariant c₁ request entities) (h₂ : InstanceOfWellFormedEnvironment request entities env) (h₃ : Validation.typeOf (Spec.Expr.call xfn xs) c₁ env = Except.ok (ty, c₂)) (ih : ∀ (xᵢ : Spec.Expr), xᵢ xsTypeOfIsSound xᵢ) :
GuardedCapabilitiesInvariant (Spec.Expr.call xfn xs) c₂ request entities (v : Spec.Value), EvaluatesTo (Spec.Expr.call xfn xs) request entities v InstanceOfType env v ty.typeOf
theorem Cedar.Thm.type_of_call_duration_converter_is_sound {xfn : Spec.ExtFun} {xs : List Spec.Expr} {c₁ c₂ : Validation.Capabilities} {env : Validation.TypeEnv} {ty : Validation.TypedExpr} {request : Spec.Request} {entities : Spec.Entities} (h₀ : IsDurationConverter xfn) (h₁ : CapabilitiesInvariant c₁ request entities) (h₂ : InstanceOfWellFormedEnvironment request entities env) (h₃ : Validation.typeOf (Spec.Expr.call xfn xs) c₁ env = Except.ok (ty, c₂)) (ih : ∀ (xᵢ : Spec.Expr), xᵢ xsTypeOfIsSound xᵢ) :
GuardedCapabilitiesInvariant (Spec.Expr.call xfn xs) c₂ request entities (v : Spec.Value), EvaluatesTo (Spec.Expr.call xfn xs) request entities v InstanceOfType env v ty.typeOf
theorem Cedar.Thm.type_of_call_is_sound {xfn : Spec.ExtFun} {xs : List Spec.Expr} {c₁ c₂ : Validation.Capabilities} {env : Validation.TypeEnv} {ty : Validation.TypedExpr} {request : Spec.Request} {entities : Spec.Entities} (h₁ : CapabilitiesInvariant c₁ request entities) (h₂ : InstanceOfWellFormedEnvironment request entities env) (h₃ : Validation.typeOf (Spec.Expr.call xfn xs) c₁ env = Except.ok (ty, c₂)) (ih : ∀ (xᵢ : Spec.Expr), xᵢ xsTypeOfIsSound xᵢ) :
GuardedCapabilitiesInvariant (Spec.Expr.call xfn xs) c₂ request entities (v : Spec.Value), EvaluatesTo (Spec.Expr.call xfn xs) request entities v InstanceOfType env v ty.typeOf
theorem Cedar.Thm.type_of_preserves_evaluation_results_call {xfn : Spec.ExtFun} {ty : Validation.TypedExpr} {c₂ : Validation.Capabilities} {request : Spec.Request} {entities : Spec.Entities} {xs : List Spec.Expr} {tys : List Validation.TypedExpr} :
Validation.typeOfCall xfn tys xs = Except.ok (ty, c₂)List.mapM (fun (x : Spec.Expr) => Spec.evaluate x request entities) xs = List.mapM (fun (y : Validation.TypedExpr) => Spec.evaluate y.toExpr request entities) tysSpec.evaluate (Spec.Expr.call xfn xs) request entities = Spec.evaluate ty.toExpr request entities