Typecheck policy at level with environments no dne
Cedar.Thm.typecheck_policy_at_level_with_environments_no_dne
Plain-language statement
The _no_dne analogue of typecheck_policy_at_level_with_environments_is_sound: a policy that level-checks against every environment of the schema (and so, in particular, the one the request inhabits), evaluated against a store closed at that level, never produces entityDoesNotExist.
Exact Lean statement
theorem typecheck_policy_at_level_with_environments_no_dne {p : Policy} {schema : Schema} {n : Nat} {request : Request} {entities : Entities}
(he : ∃ env ∈ schema.environments, InstanceOfWellFormedEnvironment request entities env)
(hcl : EntitiesClosedAtLevel entities request n)
(htl : typecheckPolicyWithEnvironments (typecheckPolicyWithLevel · n) p schema = .ok ()) :
evaluate p.toExpr request entities ≠ .error .entityDoesNotExistFormal artifact
Lean source
theorem typecheck_policy_at_level_with_environments_no_dne {p : Policy} {schema : Schema} {n : Nat} {request : Request} {entities : Entities} (he : ∃ env ∈ schema.environments, InstanceOfWellFormedEnvironment request entities env) (hcl : EntitiesClosedAtLevel entities request n) (htl : typecheckPolicyWithEnvironments (typecheckPolicyWithLevel · n) p schema = .ok ()) : evaluate p.toExpr request entities ≠ .error .entityDoesNotExist:= by replace htl : ∀ x ∈ schema.environments, ∃ tx, typecheckPolicyWithLevel p n x = .ok tx := by simp only [typecheckPolicyWithEnvironments, Except.mapError] at htl simp_do_let (checkEntities schema p.toExpr) as hes at htl simp_do_let (List.mapM (typecheckPolicyWithLevel p n) schema.environments) as htl₁ at htl replace htl₁ := List.forall₂_implies_all_left ∘ List.mapM_ok_iff_forall₂.mp $ htl₁ intro env he specialize htl₁ env he simp only [htl₁.imp, and_imp, imp_self, implies_true] have ⟨env, ⟨he₁, hr⟩⟩ := he specialize htl env he₁ replace ⟨_, htl⟩ := htl exact typecheck_policy_with_level_no_dne hr hcl htl- Project
- Cedar Specification
- License
- Apache-2.0
- Commit
- 3f093947b8ae
- Source
- cedar-lean/Cedar/Thm/Validation/Levels.lean:181-198
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.