All proofs
Project-declaredLean 4.31.0 · null

Batched authorize decision eq authorize

Cedar.Thm.batched_authorize_decision_eq_authorize

Project documentation

The main correctness theorem for batched authorization: If the batched authorizer reaches a definitive decision, that decision agrees with the concrete authorizer. Request and policy well-typedness are checked by batchedAuthorize, so we do not need those as an explicit precondition. We do need entity to explicitly require well-typed entities because `ba...

Exact Lean statement

theorem batched_authorize_decision_eq_authorize
  {schema : Schema} {policies : List Policy} {req : Request}
  {es : Entities} {response : TPE.Response} {d : Decision} :
  EntityLoader.WellBehaved es loader →
  schema.validateWellFormed = .ok () →
  validateEntities schema es = .ok () →
  batchedAuthorize schema policies req loader iters = .ok response →
  response.decision = some d →
  (Spec.isAuthorized req es policies).decision = d

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem batched_authorize_decision_eq_authorize  {schema : Schema} {policies : List Policy} {req : Request}  {es : Entities} {response : TPE.Response} {d : Decision} :  EntityLoader.WellBehaved es loader   schema.validateWellFormed = .ok ()   validateEntities schema es = .ok ()   batchedAuthorize schema policies req loader iters = .ok response   response.decision = some d   (Spec.isAuthorized req es policies).decision = d:= by  intro h_loader h_schema_wf h_entities h_batched h_dec  simp only [batchedAuthorize] at h_batched  cases h_mapM : policies.mapM (λ p =>    ResidualPolicy.mk p.id p.effect <$> evaluatePolicy schema p req.asPartialRequest Map.empty) with  | error e => simp [h_mapM, bind_pure_comp] at h_batched  | ok residualPolicies =>    simp only [bind_pure_comp, h_mapM, Except.map_ok, Except.ok.injEq] at h_batched    subst h_batched    rw [List.mapM_ok_iff_forall₂] at h_mapM    match policies, h_mapM with    | [], .nil =>      have h_dec' : (isAuthorizedFromResiduals []).decision = some .deny := by        simp [isAuthorizedFromResiduals, isAuthorizedFromResiduals.satisfiedPolicies, isAuthorizedFromResiduals.residualPolicies]      apply residuals_decision_agrees .nil      unfold batchedAuthorizeLoop at h_dec      simpa [h_dec'] using h_dec    | p :: _, .cons h_first h_rest =>      have r, h_ep :  r, evaluatePolicy schema p req.asPartialRequest Map.empty = .ok r := by        cases h_ep : evaluatePolicy schema p req.asPartialRequest Map.empty <;>          simp [h_ep] at  h_first      obtain env, h_schema_env, h_wf :=        evaluatePolicy_ok_implies_well_formed_env h_ep h_schema_wf h_entities      have h_ref : RequestAndEntitiesRefine req es req.asPartialRequest Map.empty :=        as_partial_request_refines, any_refines_empty_entities      exact batched_authorize_loop_decision_agrees es h_loader        (evaluatePolicies_equiv_and_well_typed (.cons h_first h_rest) h_schema_env h_wf h_ref)        h_ref h_wf h_dec
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/BatchedEvaluator.lean:66-102

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

Project-declaredLean 4.31.0

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.

authorizationprogram verificationsemantics

Source project: Cedar Specification

Person-level attribution pending.

View proof record
Project-declaredLean 4.31.0

Find? notmem keys

Cedar.Data.Map.find?_notmem_keys

Plain-language statement

Inverse of find?_mem_toList, except that this requires wf

authorizationprogram verificationsemantics

Source project: Cedar Specification

Person-level attribution pending.

View proof record
Project-declaredLean 4.31.0

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

authorizationprogram verificationsemantics

Source project: Cedar Specification

Person-level attribution pending.

View proof record