All proofs
Project-declaredLean 4.31.0 · null

Opt compile correctness record

Cedar.Thm.Opt.compile.correctness.record

Project documentation

Correctness theorem for Opt.compile -- record case

Exact Lean statement

theorem Opt.compile.correctness.record (m : List (Attr × Expr)) (εnv : SymEnv) :
  Opt.compile (.record m) εnv = (do
    let term ← SymCC.compile (.record m) εnv
    let footprint := footprint (.record m) εnv
    .ok { term, footprint }
  )

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem Opt.compile.correctness.record (m : List (Attr × Expr)) (εnv : SymEnv) :  Opt.compile (.record m) εnv = (do    let term  SymCC.compile (.record m) εnv    let footprint := footprint (.record m) εnv    .ok { term, footprint }  ):= by  simp [Opt.compile, SymCC.compile, footprint]  simp only [List.mapM₂_eq_mapM (λ x => do Except.ok (x.fst,  Opt.compile x.snd εnv)) m]  simp only [List.mapM₂_eq_mapM (λ x => do Except.ok (x.fst,  SymCC.compile x.snd εnv)) m]  rw [List.mapUnion₂_eq_mapUnion (λ x => footprint x.snd εnv)]  simp_do_let m.mapM (m := SymCC.Result) _ as hmap₁  <;> simp_do_let m.mapM (m := SymCC.Result) _ as hmap₂  case error.error e₁ e₂ =>    simp only [Except.error.injEq]    apply both_lists_pairs_error_then_errors_same hmap₁ hmap₂    intro pair hpair    have := List.sizeOf_lt_of_mem hpair -- for termination    have : sizeOf pair.snd < sizeOf pair := by simp [sizeOf, Prod._sizeOf_1] ; omega    exact Opt.compile.correctness pair.snd εnv  case ok.error ts e =>    exfalso    replace x, hx, hmap₂ := List.mapM_error_implies_exists_error hmap₂    replace t, ht, hmap₁ := List.mapM_ok_implies_all_ok hmap₁ x hx    have := List.sizeOf_lt_of_mem hx -- for termination    have : sizeOf x.snd < sizeOf x := by simp [sizeOf, Prod._sizeOf_1] ; omega    rw [Opt.compile.correctness] at hmap₁    simp [do_error] at hmap₂    simp [hmap₂] at hmap₁  case error.ok e ts =>    exfalso    replace x, hx, hmap₁ := List.mapM_error_implies_exists_error hmap₁    replace t, ht, hmap₂ := List.mapM_ok_implies_all_ok hmap₂ x hx    have := List.sizeOf_lt_of_mem hx -- for termination    have : sizeOf x.snd < sizeOf x := by simp [sizeOf, Prod._sizeOf_1] ; omega    rw [Opt.compile.correctness] at hmap₁    simp [do_error] at hmap₁    simp [hmap₁] at hmap₂  case ok.ok ts₁ ts₂ =>    rw [Opt.compileRecord.correctness]    simp only [Except.ok.injEq, Opt.CompileResult.mk.injEq]    have h₁, h₂ := both_lists_pairs_ok_then_elts_correspond hmap₁ hmap₂ (by      intro pair hpair      have := List.sizeOf_lt_of_mem hpair -- for termination      have : sizeOf pair.snd < sizeOf pair := by simp [sizeOf, Prod._sizeOf_1] ; omega      exact Opt.compile.correctness pair.snd εnv    )    subst ts₂ ; simp    apply List.map_eqv_implies_mapUnion_eq (by simp [h₂, List.Equiv.refl])
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/SymCC/Opt/Compiler.lean:998-1046

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