All proofs
Project-declaredLean 4.31.0 · null

Level based no dne get attr entity

Cedar.Thm.level_based_no_dne_get_attr_entity

Plain-language statement

Entity branch. getAttr (entity euid) a es = es.attrs euid >>= (·.findOrErr a attrDoesNotExist), which DNEs iff euid ∉ es. By soundness e evaluates to an entity (or errors, in which case the IH rules out a DNE error and the remaining error kinds are not entityDoesNotExist). When it evaluates to entity euid, checked_eval_entity_exists shows `eui...

Exact Lean statement

theorem level_based_no_dne_get_attr_entity {e : Expr} {tx₁ : TypedExpr} {ty : CedarType} {ety : EntityType} {a : Attr} {n : Nat} {c₀ c₁ : Capabilities} {env : TypeEnv} {request : Request} {entities : Entities}
  (hc : CapabilitiesInvariant c₀ request entities)
  (hr : InstanceOfWellFormedEnvironment request entities env)
  (hcl : EntitiesClosedAtLevel entities request n)
  (hl : (tx₁.getAttr a ty).AtLevel env n)
  (ht : typeOf e c₀ env = Except.ok (tx₁, c₁))
  (hety : tx₁.typeOf = CedarType.entity ety)
  (ihe : TypedAtLevelHasNoDNEError e) :
  evaluate (.getAttr e a) request entities ≠ .error .entityDoesNotExist

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem level_based_no_dne_get_attr_entity {e : Expr} {tx₁ : TypedExpr} {ty : CedarType} {ety : EntityType} {a : Attr} {n : Nat} {c₀ c₁ : Capabilities} {env : TypeEnv} {request : Request} {entities : Entities}  (hc : CapabilitiesInvariant c₀ request entities)  (hr : InstanceOfWellFormedEnvironment request entities env)  (hcl : EntitiesClosedAtLevel entities request n)  (hl : (tx₁.getAttr a ty).AtLevel env n)  (ht : typeOf e c₀ env = Except.ok (tx₁, c₁))  (hety : tx₁.typeOf = CedarType.entity ety)  (ihe : TypedAtLevelHasNoDNEError e) :  evaluate (.getAttr e a) request entities  .error .entityDoesNotExist:= by  have  hgc, v, he, hv  := type_of_is_sound hc hr ht  rw [hety] at hv  replace  euid, hety', hv  := instance_of_entity_type_is_entity hv  subst hety' hv  cases hl  case getAttrRecord hnety _ =>    specialize hnety euid.ty    contradiction  rename_i n hel₁ hl₁ _  simp only [evaluate]  have hl₁' := entity_access_at_level_then_at_level hl₁  unfold EvaluatesTo at he  rcases he with he | he | he | he  · exact absurd he (ihe hc hr hcl ht hl₁')  · simp [he]  · simp [he]  · have hcont := checked_eval_entity_exists hc hr ht hl₁ he (.euid euid) hcl    obtain  ed, hed  := Map.contains_iff_some_find?.mp hcont    simp only [he, Except.bind_ok, getAttr, attrsOf, Entities.attrs, Map.findOrErr, hed]    split <;> simp
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/Validation/Levels/NoEntitiesError.lean:458-487

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