All proofs
Project-declaredLean 4.31.0 · null

Ways and can error

Cedar.Thm.ways_and_can_error

Plain-language statement

If an and expression results in an error, it's because either: - the left subexpression had that error - the right subexpression had that error (and the left subexpression evaluated to .ok true) - the left subexpression evaluated to .ok with a non-bool - the right subexpression evaluated to .ok with a non-bool (and the left subexpression evaluated to .o...

Exact Lean statement

theorem ways_and_can_error {e₁ e₂ : Expr} {request : Request} {entities : Entities} {err : Error} :
  evaluate (Expr.and e₁ e₂) request entities = .error err →
  evaluate e₁ request entities = .error err ∨
  (evaluate e₁ request entities = .ok true ∧ evaluate e₂ request entities = .error err) ∨
  (err = Error.typeError ∧ producesNonBool e₁ request entities) ∨
  (err = Error.typeError ∧ evaluate e₁ request entities = .ok true ∧ producesNonBool e₂ request entities)

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem ways_and_can_error {e₁ e₂ : Expr} {request : Request} {entities : Entities} {err : Error} :  evaluate (Expr.and e₁ e₂) request entities = .error err   evaluate e₁ request entities = .error err   (evaluate e₁ request entities = .ok true  evaluate e₂ request entities = .error err)   (err = Error.typeError  producesNonBool e₁ request entities)   (err = Error.typeError  evaluate e₁ request entities = .ok true  producesNonBool e₂ request entities):= by  intro h₁  cases h_e₁ : (evaluate e₁ request entities) <;> simp [h_e₁, producesNonBool]  case ok val =>    cases val <;>    simp [h_e₁, evaluate, Result.as, Coe.coe, Value.asBool] at h₁ <;>    simp [h₁]    case prim prim =>      cases prim <;>      simp at h₁ <;>      simp [h₁]      case bool b =>        cases b with        | true =>          simp only [true_and]          simp only [reduceCtorEq] at h₁          cases h_e₂ : (evaluate e₂ request entities) with          | ok val =>            cases val <;>            simp [h_e₂] at h₁ <;>            simp [h₁]            case prim prim =>              cases prim <;>              simp at h₁ <;>              simp [h₁]          | error e =>            simp only [↓reduceIte, h_e₂, Except.map_error, Except.error.injEq] at h₁            simp only [h₁, and_false, or_false]        | false => simp at h₁  case error e =>    simp [h_e₁, evaluate, Result.as, Coe.coe, Value.asBool] at h₁    simp [h₁]
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/Authorization/Evaluator.lean:133-170

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