Record value contains evaluated attrs
Cedar.Thm.record_value_contains_evaluated_attrs
Plain-language statement
If evaluating a record produces a record value containing an attribute, then that attribute existed in the original record, and corresponding expression evaluates to the same value.
Exact Lean statement
theorem record_value_contains_evaluated_attrs {rxs : List (Attr × Expr)} {rvs : Map Attr Value} {a : Attr} {av : Value} {request : Request} {entities : Entities}
(he : evaluate (.record rxs) request entities = .ok (.record rvs))
(hfv : rvs.find? a = some av) :
∃ x, (Map.make rxs).find? a = some x ∧ evaluate x request entities = .ok avFormal artifact
Lean source
theorem record_value_contains_evaluated_attrs {rxs : List (Attr × Expr)} {rvs : Map Attr Value} {a : Attr} {av : Value} {request : Request} {entities : Entities} (he : evaluate (.record rxs) request entities = .ok (.record rvs)) (hfv : rvs.find? a = some av) : ∃ x, (Map.make rxs).find? a = some x ∧ evaluate x request entities = .ok av:= by simp only [evaluate] at he cases he₁ : rxs.mapM₂ fun x => bindAttr x.1.fst (evaluate x.1.snd request entities) <;> simp only [he₁, Except.bind_err, reduceCtorEq, Except.bind_ok, Except.ok.injEq, Value.record.injEq] at he subst rvs rename_i rvs' replace he₁ : List.Forallᵥ (λ x y => evaluate x request entities = Except.ok y) rxs rvs' := by simp only [List.forallᵥ_def] rw [List.mapM₂_eq_mapM λ (x : Attr × Expr) => bindAttr x.fst (evaluate x.snd request entities)] at he₁ rw [List.mapM_ok_iff_forall₂] at he₁ apply List.Forall₂.imp _ he₁ intro x y h simp only [bindAttr] at h simp_do_let (evaluate x.snd request entities) as hx at h simp only [pure, Except.pure, Except.ok.injEq] at h simp only [←h, and_self] replace he₁ := List.canonicalize_preserves_forallᵥ _ _ _ he₁ have hfv : List.find? (λ x => x.fst == a) (Map.make rvs').toList = some (a, av) := by simp only [Map.find?] at hfv split at hfv <;> simp only [Option.some.injEq, reduceCtorEq] at hfv subst hfv rename_i a' _ hfv rw [(by simpa using List.find?_some hfv : a' = a)] at hfv exact hfv rw [List.forallᵥ_def] at he₁ rw [Map.toList_make_eq_canonicalize] at hfv have ⟨(a', x), he₂, he₃⟩ := List.forall₂_implies_all_right he₁ (a, av) (List.mem_of_find?_eq_some hfv) simp only at he₃ ; replace ⟨_, he₃⟩ := he₃ ; subst a' exists x simp [Map.find?, Map.toList_make_eq_canonicalize, List.mem_of_sortedBy_implies_find? he₂ (List.canonicalize_sortedBy _ _), he₃]- Project
- Cedar Specification
- License
- Apache-2.0
- Commit
- 3f093947b8ae
- Source
- cedar-lean/Cedar/Thm/Authorization/Evaluator.lean:236-269
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.