All proofs
Project-declaredLean 4.31.0 · null

Check Matches Implies Opt eqv check Matches Implies

Cedar.Thm.checkMatchesImpliesOpt_eqv_checkMatchesImplies

Plain-language statement

Full equivalence for checkMatchesImplies and checkMatchesImpliesOpt, including both the .ok and .error cases

Exact Lean statement

theorem checkMatchesImpliesOpt_eqv_checkMatchesImplies {p₁ p₂ : Policy} {Γ : Validation.TypeEnv} :
  Γ.WellFormed →
  (do
    let cp₁ ← CompiledPolicy.compile p₁ Γ
    let cp₂ ← CompiledPolicy.compile p₂ Γ
    pure $ checkMatchesImpliesOpt cp₁ cp₂
  ) =
  (do
    let wp₁ ← wellTypedPolicy p₁ Γ |>.mapError .validationError
    let wp₂ ← wellTypedPolicy p₂ Γ |>.mapError .validationError
    pure $ checkMatchesImplies wp₁ wp₂ (SymEnv.ofTypeEnv Γ)
  )

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem checkMatchesImpliesOpt_eqv_checkMatchesImplies {p₁ p₂ : Policy} {Γ : Validation.TypeEnv} :  Γ.WellFormed   (do    let cp₁  CompiledPolicy.compile p₁ Γ    let cp₂  CompiledPolicy.compile p₂ Γ    pure $ checkMatchesImpliesOpt cp₁ cp₂  ) =  (do    let wp₁  wellTypedPolicy p₁ Γ |>.mapError .validationError    let wp₂  wellTypedPolicy p₂ Γ |>.mapError .validationError    pure $ checkMatchesImplies wp₁ wp₂ (SymEnv.ofTypeEnv Γ)  ):= by  intro hwf  have h₁ := compile_ok_iff_welltypedpolicy_ok hwf (p := p₁)  have h₂ := compile_ok_iff_welltypedpolicy_ok hwf (p := p₂)  cases hcp₁ : CompiledPolicy.compile p₁ Γ  <;> cases hcp₂ : CompiledPolicy.compile p₂ Γ  <;> cases hwp₁ : wellTypedPolicy p₁ Γ  <;> cases hwp₂ : wellTypedPolicy p₂ Γ  -- this eliminates all the cases where the behavior of CompiledPolicy.compile is inconsistent  -- with the behavior of wellTypedPolicy on the same policy  <;> simp_all [Except.mapError, Except.isOk, Except.toBool]  case ok.ok.ok.ok cp₁ cp₂ wp₁ wp₂ =>    exact checkMatchesImpliesOpt_eqv_checkMatchesImplies_ok hwf hcp₁ hcp₂ hwp₁ hwp₂  case error.ok.error.ok | error.error.error.error =>    simp [CompiledPolicy.compile, Except.mapError, hwp₁] at hcp₁    simp [hcp₁]  case ok.error.ok.error =>    simp [CompiledPolicy.compile, Except.mapError, hwp₂] at hcp₂    simp [hcp₂]
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/SymCC/Opt.lean:1258-1288

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