Partial evaluate policy is sound
Cedar.Thm.partial_evaluate_policy_is_sound
Plain-language statement
Policy evaluation soundness for TPE: Evaluating a result residual is equivalent to evaluating the input policy, given valid and consistent requests and entities. The equivalence is w.r.t authorization results. That is, the evaluation results are strictly equal when they are .ok or both errors (captured by Except.toOption). We do not care if the error...
Exact Lean statement
theorem partial_evaluate_policy_is_sound
{schema : Schema}
{residual : Residual}
{policy : Policy}
{req : Request}
{es : Entities}
{preq : PartialRequest}
{pes : PartialEntities}
{env : TypeEnv} :
evaluatePolicy schema policy preq pes = .ok residual →
schema.environment? preq.principal.ty preq.resource.ty preq.action = .some env →
InstanceOfWellFormedEnvironment req es env →
RequestAndEntitiesRefine req es preq pes →
(Spec.evaluate policy.toExpr req es).toOption = (Residual.evaluate residual req es).toOptionFormal artifact
Lean source
theorem partial_evaluate_policy_is_sound {schema : Schema} {residual : Residual} {policy : Policy} {req : Request} {es : Entities} {preq : PartialRequest} {pes : PartialEntities} {env : TypeEnv} : evaluatePolicy schema policy preq pes = .ok residual → schema.environment? preq.principal.ty preq.resource.ty preq.action = .some env → InstanceOfWellFormedEnvironment req es env → RequestAndEntitiesRefine req es preq pes → (Spec.evaluate policy.toExpr req es).toOption = (Residual.evaluate residual req es).toOption:= by intro h₁ h_schema_env h₄ h₃ simp [evaluatePolicy, h_schema_env] at h₁ split at h₁ <;> try cases h₁ cases hcheck : Except.mapError Error.invalidPolicy (checkEntities schema policy.toExpr) <;> simp only [hcheck, Except.bind_err, reduceCtorEq] at h₁ simp [do_ok_eq_ok] at h₁ rcases h₁ with ⟨_, ⟨_, h₁₁⟩, h₁₂⟩ simp [Except.mapError] at h₁₁ split at h₁₁ <;> try cases h₁₁ rename_i ty _ _ heq₂ have h₅ := typechecked_is_well_typed_after_lifting heq₂ have h₉ : Residual.WellTyped env (TypedExpr.toResidual ty.liftBoolTypes) := conversion_preserves_typedness h₅ have h₆ := partial_evaluate_is_sound h₉ h₄ h₃ subst h₁₂ have h₇ := type_of_preserves_evaluation_results (empty_capabilities_invariant req es) h₄ heq₂ have h₈ : Spec.evaluate (substituteAction env.reqty.action policy.toExpr) req es = Spec.evaluate policy.toExpr req es := by simp [InstanceOfWellFormedEnvironment] at h₄ rcases h₄ with ⟨_, h₄, _⟩ simp [InstanceOfRequestType] at h₄ rcases h₄ with ⟨_, h₄, _⟩ rw [←h₄] exact substitute_action_preserves_evaluation policy.toExpr req es simp [h₈] at h₇ rw [h₇, type_lifting_preserves_expr, ← h₆] congr apply conversion_preserves_evaluation- Project
- Cedar Specification
- License
- Apache-2.0
- Commit
- 3f093947b8ae
- Source
- cedar-lean/Cedar/Thm/TPE/Policy.lean:46-87
Reuse this declaration
Bring the exact result into your workflow
The import identifies the source module. Your project still needs the pinned package dependency shown on this page.
What this badge means
This completion status comes from the project or community source. It has not yet been represented here as an independent rebuild and axiom audit.
Continue in this project
Related declarations
Find? ext
Cedar.Data.Map.find?_ext
Plain-language statement
Two well-formed maps are equal if they have the same find? for every key.
Source project: Cedar Specification
Person-level attribution pending.
Find? notmem keys
Cedar.Data.Map.find?_notmem_keys
Plain-language statement
Inverse of find?_mem_toList, except that this requires wf
Source project: Cedar Specification
Person-level attribution pending.
Find? some iff in values
Cedar.Data.Map.find?_some_iff_in_values
Plain-language statement
The mp direction of this does not need the wf precondition and, in fact, is available separately as find?_some_implies_in_values above
Source project: Cedar Specification
Person-level attribution pending.