Verify Evaluate Pair Opt eqv verify Evaluate Pair ok
Cedar.Thm.verifyEvaluatePairOpt_eqv_verifyEvaluatePair_ok
Project documentation
This theorem covers the "happy path" -- showing that if optimized policy compilation succeeds, then verifyEvaluatePair and verifyEvaluatePairOpt are equivalent.
Exact Lean statement
theorem verifyEvaluatePairOpt_eqv_verifyEvaluatePair_ok {p₁ p₂ wp₁ wp₂ : Policy} {cp₁ cp₂ : CompiledPolicy} {Γ : Validation.TypeEnv} {φ : Term → Term → Term} :
CompiledPolicy.compile p₁ Γ = .ok cp₁ →
CompiledPolicy.compile p₂ Γ = .ok cp₂ →
wellTypedPolicy p₁ Γ = .ok wp₁ →
wellTypedPolicy p₂ Γ = .ok wp₂ →
verifyEvaluatePair φ wp₁ wp₂ (SymEnv.ofTypeEnv Γ) ~ .ok (verifyEvaluatePairOpt φ cp₁ cp₂)Formal artifact
Lean source
theorem verifyEvaluatePairOpt_eqv_verifyEvaluatePair_ok {p₁ p₂ wp₁ wp₂ : Policy} {cp₁ cp₂ : CompiledPolicy} {Γ : Validation.TypeEnv} {φ : Term → Term → Term} : CompiledPolicy.compile p₁ Γ = .ok cp₁ → CompiledPolicy.compile p₂ Γ = .ok cp₂ → wellTypedPolicy p₁ Γ = .ok wp₁ → wellTypedPolicy p₂ Γ = .ok wp₂ → verifyEvaluatePair φ wp₁ wp₂ (SymEnv.ofTypeEnv Γ) ~ .ok (verifyEvaluatePairOpt φ cp₁ cp₂):= by simp [verifyEvaluatePair, verifyEvaluatePairOpt, ResultAssertsEquiv] intro h₀ h₁ h₂ h₃ have henv : cp₁.εnv = cp₂.εnv := by simp [cp_compile_produces_the_right_env h₀, cp_compile_produces_the_right_env h₁] simp [henv] simp [enforcePairCompiledPolicy_eqv_enforce_ok h₀ h₁ h₂ h₃] cases h₄ : compile wp₁.toExpr (SymEnv.ofTypeEnv Γ) <;> simp case error e => simp only [CompiledPolicy.compile, Except.mapError, h₂, Except.bind_ok] at h₀ rw [Opt.compile.correctness] at h₀ simp [h₄] at h₀ case ok t₁ => have h₅ := (cp_compile_produces_the_right_term h₀ h₂).symm ; simp [h₄] at h₅ ; subst t₁ cases h₆ : compile wp₂.toExpr (SymEnv.ofTypeEnv Γ) <;> simp case error e => simp only [CompiledPolicy.compile, Except.mapError, h₃, Except.bind_ok] at h₁ rw [Opt.compile.correctness] at h₁ simp [h₆] at h₁ case ok t₂ => have h₇ := (cp_compile_produces_the_right_term h₁ h₃).symm ; simp [h₆] at h₇ ; subst t₂ split <;> rename_i hnot · apply Asserts.Equiv.constantFalse <;> simp [hnot] · apply Asserts.Equiv.rfl- Project
- Cedar Specification
- License
- Apache-2.0
- Commit
- 3f093947b8ae
- Source
- cedar-lean/Cedar/Thm/SymCC/Opt/Verifier.lean:61-90
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.