All proofs
Project-declaredLean 4.31.0 · null

Partial evaluate is sound

Cedar.Thm.partial_evaluate_is_sound

Project documentation

The main lemma: Evaluating a residual derived from partially evaluating a well-typed expression is equivalent to that of evaluating the original expression, provided that requests and entities are consistent. The equivalency is defined using Except.toOption.

Exact Lean statement

theorem partial_evaluate_is_sound
  {x : Residual}
  {req : Request}
  {es : Entities}
  {preq : PartialRequest}
  {pes : PartialEntities}
  {env : TypeEnv} :
  Residual.WellTyped env x →
  InstanceOfWellFormedEnvironment req es env →
  RequestAndEntitiesRefine req es preq pes →
  (x.evaluate req es).toOption = ((Cedar.TPE.evaluate x preq pes).evaluate req es).toOption

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem partial_evaluate_is_sound  {x : Residual}  {req : Request}  {es : Entities}  {preq : PartialRequest}  {pes : PartialEntities}  {env : TypeEnv} :  Residual.WellTyped env x   InstanceOfWellFormedEnvironment req es env   RequestAndEntitiesRefine req es preq pes   (x.evaluate req es).toOption = ((Cedar.TPE.evaluate x preq pes).evaluate req es).toOption:= by  intro h₁ h₂ h₃  induction h₁  case val =>    exact partial_evaluate_is_sound_val  case var =>    exact partial_evaluate_is_sound_var h₃  case ite x₁ x₂ x₃ hwt _ _ hₜ _ hᵢ₁ hᵢ₂ hᵢ₃ =>    exact partial_evaluate_is_sound_ite h₂ hwt hₜ hᵢ₁ hᵢ₂ hᵢ₃  case and x₁ x₂ hᵢ₁ hᵢ₂ hᵢ₃ hᵢ₄ hᵢ₅ hᵢ₆ =>    exact partial_evaluate_is_sound_and h₂ h₃ hᵢ₁ hᵢ₂ hᵢ₃ hᵢ₄ hᵢ₅ hᵢ₆  case or x₁ x₂ hᵢ₁ hᵢ₂ hᵢ₃ hᵢ₄ hᵢ₅ hᵢ₆ =>    exact partial_evaluate_is_sound_or h₂ h₃ hᵢ₁ hᵢ₂ hᵢ₃ hᵢ₄ hᵢ₅ hᵢ₆  case unaryApp op₁ x₁ ty hᵢ₁ =>    exact partial_evaluate_is_sound_unary_app h₃ hᵢ₁  case binaryApp op₂ x₁ x₂ ty _ hwt howt hᵢ₁ hᵢ₂ =>    exact partial_evaluate_is_sound_binary_app h₂ h₃ hwt howt hᵢ₁ hᵢ₂  case hasAttr_entity ety x₁ attr hᵢ₁ =>    exact partial_evaluate_is_sound_has_attr h₃ hᵢ₁  case hasAttr_record rty x₁ attr hᵢ₁ =>    exact partial_evaluate_is_sound_has_attr h₃ hᵢ₁  case getAttr_entity ety rty x₁ attr ty hᵢ₁ =>    exact partial_evaluate_is_sound_get_attr h₃ hᵢ₁  case getAttr_record rty x₁ attr ty hᵢ₁ =>    exact partial_evaluate_is_sound_get_attr h₃ hᵢ₁  case set ls ty hᵢ₁ =>    exact partial_evaluate_is_sound_set hᵢ₁  case record rty m hᵢ₁ hᵢ₁ =>    exact partial_evaluate_is_sound_record hᵢ₁  case call xfn args ty hᵢ₁ =>    exact partial_evaluate_is_sound_call hᵢ₁  case error ty =>    exact partial_evaluate_is_sound_error
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/TPE/Soundness.lean:63-106

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