All proofs
Project-declaredLean 4.31.0 · null

Check Implies Opt eqv check Implies

Cedar.Thm.checkImpliesOpt_eqv_checkImplies

Plain-language statement

Full equivalence for checkImplies and checkImpliesOpt, including both the .ok and .error cases

Exact Lean statement

theorem checkImpliesOpt_eqv_checkImplies {ps₁ ps₂ : Policies} {Γ : Validation.TypeEnv} :
  Γ.WellFormed →
  (do
    let cpset₁ ← CompiledPolicySet.compile ps₁ Γ
    let cpset₂ ← CompiledPolicySet.compile ps₂ Γ
    pure $ checkImpliesOpt cpset₁ cpset₂
  ) =
  (do
    let wps₁ ← wellTypedPolicies ps₁ Γ |>.mapError .validationError
    let wps₂ ← wellTypedPolicies ps₂ Γ |>.mapError .validationError
    pure $ checkImplies wps₁ wps₂ (SymEnv.ofTypeEnv Γ)
  )

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem checkImpliesOpt_eqv_checkImplies {ps₁ ps₂ : Policies} {Γ : Validation.TypeEnv} :  Γ.WellFormed   (do    let cpset₁  CompiledPolicySet.compile ps₁ Γ    let cpset₂  CompiledPolicySet.compile ps₂ Γ    pure $ checkImpliesOpt cpset₁ cpset₂  ) =  (do    let wps₁  wellTypedPolicies ps₁ Γ |>.mapError .validationError    let wps₂  wellTypedPolicies ps₂ Γ |>.mapError .validationError    pure $ checkImplies wps₁ wps₂ (SymEnv.ofTypeEnv Γ)  ):= by  intro hwf  have h₁ := compile_ok_iff_welltypedpolicies_ok hwf (ps := ps₁)  have h₂ := compile_ok_iff_welltypedpolicies_ok hwf (ps := ps₂)  cases hcpset₁ : CompiledPolicySet.compile ps₁ Γ  <;> cases hcpset₂ : CompiledPolicySet.compile ps₂ Γ  <;> cases hwps₁ : wellTypedPolicies ps₁ Γ  <;> cases hwps₂ : wellTypedPolicies ps₂ Γ  -- this eliminates all the cases where the behavior of CompiledPolicySet.compile is inconsistent  -- with the behavior of wellTypedPolicies on the same policyset  <;> simp_all [Except.mapError, Except.isOk, Except.toBool]  case ok.ok.ok.ok cpset₁ cpset₂ wps₁ wps₂ =>    have wps₁', wps₂', hwps₁', hwps₂', h := checkImpliesOpt_eqv_checkImplies_ok hwf hcpset₁ hcpset₂    simp_all  case error.ok.error.ok | error.error.error.error =>    simp [CompiledPolicySet.compile, Except.mapError, hwps₁] at hcpset₁    simp [hcpset₁]  case ok.error.ok.error =>    simp [CompiledPolicySet.compile, Except.mapError, hwps₂] at hcpset₂    simp [hcpset₂]
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/SymCC/Opt.lean:1358-1389

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