All proofs
Project-declaredLean 4.31.0 · null

Of Record Type preserves attr

Cedar.Thm.ofRecordType_preserves_attr

Plain-language statement

If some attribute exists in a record type, then it should still exist after applying TermType.ofRecordType

Exact Lean statement

theorem ofRecordType_preserves_attr
  {rty : RecordType} {attr : Attr} {qty : Qualified CedarType} {ty : CedarType}
  (hattr_exists : Data.Map.find? rty attr = some qty)
  (hattr_ty : qty.getType = ty) :
  ∃ attr_ty : TermType,
    (Data.Map.mk (TermType.ofRecordType rty.1)).find? attr = some attr_ty ∧
    match attr_ty with
    | .option attr_ty' => TermType.ofType ty = attr_ty' ∧ ¬qty.isRequired
    | _ => TermType.ofType ty = attr_ty ∧ qty.isRequired

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
theorem ofRecordType_preserves_attr  {rty : RecordType} {attr : Attr} {qty : Qualified CedarType} {ty : CedarType}  (hattr_exists : Data.Map.find? rty attr = some qty)  (hattr_ty : qty.getType = ty) :   attr_ty : TermType,    (Data.Map.mk (TermType.ofRecordType rty.1)).find? attr = some attr_ty     match attr_ty with    | .option attr_ty' => TermType.ofType ty = attr_ty'  ¬qty.isRequired    | _ => TermType.ofType ty = attr_ty  qty.isRequired:= by  cases rty with | mk rty_1 =>  induction rty_1  case nil => simp [Data.Map.find?] at hattr_exists  case cons head tail ih =>    have k, v := head    simp only [Data.Map.find?, List.find?, TermType.ofRecordType, Data.Map.toList_mk_id, Bool.not_eq_true]    simp only [Data.Map.find?, List.find?, Data.Map.toList_mk_id, Bool.not_eq_true] at hattr_exists ih    cases e : k == attr    case false =>      simp only [e] at  hattr_exists      apply ih hattr_exists    case true =>      simp only [e, Option.some.injEq] at hattr_exists      simp only [hattr_exists, Option.some.injEq, exists_eq_left']      cases qty with      | optional =>        simp only [TermType.ofQualifiedType, Qualified.isRequired, and_true]        simp only [Qualified.getType] at hattr_ty        simp [hattr_ty]      | required =>        simp only [          TermType.ofQualifiedType, Qualified.isRequired,          Bool.true_eq_false, and_false, and_true,        ]        simp only [Qualified.getType] at hattr_ty        simp only [hattr_ty]        -- TermType.ofType never produces an option type        unfold TermType.ofType        split        case h_1 hof_type =>          split at hof_type          all_goals contradiction        simp
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/SymCC/Compiler/WellTyped.lean:80-122

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