All proofs
Project-declaredLean 4.31.0 · null

Compile binary App wf types

compile_binaryApp_wf_types

Plain-language statement

Similar to compileApp₂_wf_types, but for compile

Exact Lean statement

theorem compile_binaryApp_wf_types
  {op : BinaryOp} {a : TypedExpr} {b : TypedExpr} {ty : CedarType}
  {t : Term} {tcomp_a : Term} {tcomp_b : Term}
  {εnv : SymEnv}
  (hwf_ent : εnv.entities.WellFormed)
  (hok_a : compile a.toExpr εnv = Except.ok tcomp_a)
  (hok_b : compile b.toExpr εnv = Except.ok tcomp_b)
  (hwf_get_comp_a : Term.WellFormed εnv.entities (Factory.option.get tcomp_a))
  (hwf_get_comp_b : Term.WellFormed εnv.entities (Factory.option.get tcomp_b))
  (hok : compile (TypedExpr.toExpr (.binaryApp op a b ty)) εnv = .ok t) :
  match op with
    | .add | .sub | .mul => t.typeOf = .option (.bitvec 64)
    | .getTag            =>
      ∃ ety τs,
        (Factory.option.get tcomp_a).typeOf = .entity ety ∧
        εnv.entities.tags ety = some (some τs) ∧
        t.typeOf = τs.vals.outType.option
    | _                  => t.typeOf = .option .bool

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem compile_binaryApp_wf_types  {op : BinaryOp} {a : TypedExpr} {b : TypedExpr} {ty : CedarType}  {t : Term} {tcomp_a : Term} {tcomp_b : Term}  {εnv : SymEnv}  (hwf_ent : εnv.entities.WellFormed)  (hok_a : compile a.toExpr εnv = Except.ok tcomp_a)  (hok_b : compile b.toExpr εnv = Except.ok tcomp_b)  (hwf_get_comp_a : Term.WellFormed εnv.entities (Factory.option.get tcomp_a))  (hwf_get_comp_b : Term.WellFormed εnv.entities (Factory.option.get tcomp_b))  (hok : compile (TypedExpr.toExpr (.binaryApp op a b ty)) εnv = .ok t) :  match op with    | .add | .sub | .mul => t.typeOf = .option (.bitvec 64)    | .getTag            =>       ety τs,        (Factory.option.get tcomp_a).typeOf = .entity ety         εnv.entities.tags ety = some (some τs)         t.typeOf = τs.vals.outType.option    | _                  => t.typeOf = .option .bool:= by  simp only [TypedExpr.toExpr, compile, hok_a, hok_b, Except.bind_ok] at hok  simp_do_let    (compileApp₂ op      (Factory.option.get tcomp_a)      (Factory.option.get tcomp_b)      εnv.entities)    at hok  simp only [Except.ok.injEq] at hok  case ok tcomp_app hcomp_app =>    have h := (compileApp₂_wf_types      hwf_ent      hwf_get_comp_a      hwf_get_comp_b      hcomp_app    ).right    -- tcomp_app and t should have the same type    have heqty : t.typeOf = tcomp_app.typeOf    := by      simp only [ hok]      cases op      any_goals        simp only [h]        apply typeOf_ifSome_option        apply typeOf_ifSome_option        assumption      -- Special case for getTag      case getTag =>        have _, _, _, _, h := h        simp only [h]        apply typeOf_ifSome_option        apply typeOf_ifSome_option        assumption    cases op    any_goals      simp only [exists_and_left] at h      simp [h, heqty]
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/SymCC/Compiler/WellTyped.lean:628-682

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