Documentation

Cedar.Thm.Validation.Typechecker.LUB

This file contains useful definitions and lemmas about the least upper bound (LUB) functions on Cedar types.

theorem Cedar.Thm.lubBool_comm {bty₁ bty₂ : Validation.BoolType} :
Validation.lubBool bty₁ bty₂ = Validation.lubBool bty₂ bty₁
theorem Cedar.Thm.lub_comm {ty₁ ty₂ : Validation.CedarType} :
(ty₁ ⊔ ty₂) = (ty₂ ⊔ ty₁)
theorem Cedar.Thm.lub_trans {ty₁ ty₂ ty₃ : Validation.CedarType} :
(ty₁ ⊔ ty₂) = some ty₂ → (ty₂ ⊔ ty₃) = some ty₃ → (ty₁ ⊔ ty₃) = some ty₃
theorem Cedar.Thm.lubRecordType_trans {rty₁ rty₂ rty₃ : List (Spec.Attr × Validation.QualifiedType)} :
Validation.lubRecordType rty₁ rty₂ = some rty₂ → Validation.lubRecordType rty₂ rty₃ = some rty₃ → Validation.lubRecordType rty₁ rty₃ = some rty₃
theorem Cedar.Thm.lubQualifiedType_trans {qty₁ qty₂ qty₃ : Validation.QualifiedType} :
Validation.lubQualifiedType qty₁ qty₂ = some qty₂ → Validation.lubQualifiedType qty₂ qty₃ = some qty₃ → Validation.lubQualifiedType qty₁ qty₃ = some qty₃
theorem Cedar.Thm.subty_iff_lub?_eq_some {ty₁ ty₂ : Validation.CedarType} :
(ty₁ ⊑ ty₂) = true ↔ (ty₁ ⊔ ty₂) = some ty₂
theorem Cedar.Thm.subty_trans {ty₁ ty₂ ty₃ : Validation.CedarType} :
(ty₁ ⊑ ty₂) = true → (ty₂ ⊑ ty₃) = true → (ty₁ ⊑ ty₃) = true
theorem Cedar.Thm.lub_left_subty {ty₁ ty₂ ty₃ : Validation.CedarType} :
(ty₁ ⊔ ty₂) = some ty₃ → (ty₁ ⊑ ty₃) = true
theorem Cedar.Thm.lubRecordType_left_subty {rty₁ rty₂ rty₃ : List (Spec.Attr × Validation.QualifiedType)} :
Validation.lubRecordType rty₁ rty₂ = some rty₃ → Validation.lubRecordType rty₁ rty₃ = some rty₃
theorem Cedar.Thm.lubBool_assoc_none_some {ty₁ ty₂ : Validation.CedarType} {bty₁ bty₂ : Validation.BoolType} (h₁ : (ty₁ ⊔ Validation.CedarType.bool bty₁) = none) (h₂ : some (Validation.CedarType.bool (Validation.lubBool bty₁ bty₂)) = some ty₂) :
(ty₁ ⊔ ty₂) = none
theorem Cedar.Thm.lub_assoc_none_some {ty₁ ty₂ ty₃ ty₄ : Validation.CedarType} (h₁ : (ty₁ ⊔ ty₂) = none) (h₂ : (ty₂ ⊔ ty₃) = some ty₄) :
(ty₁ ⊔ ty₄) = none
theorem Cedar.Thm.lubRecordType_assoc_none_some {rty₁ rty₂ rty₃ rty₄ : List (Spec.Attr × Validation.QualifiedType)} (h₁ : Validation.lubRecordType rty₁ rty₂ = none) (h₂ : Validation.lubRecordType rty₂ rty₃ = some rty₄) :
theorem Cedar.Thm.lubQualifiedType_assoc_none_some {qty₁ qty₂ qty₃ qty₄ : Validation.QualifiedType} (h₁ : Validation.lubQualifiedType qty₁ qty₂ = none) (h₂ : Validation.lubQualifiedType qty₂ qty₃ = some qty₄) :
theorem Cedar.Thm.lubBool_assoc_some_some {ty₄ ty₅ : Validation.CedarType} {bty₁ bty₂ bty₃ : Validation.BoolType} (h₁ : Validation.CedarType.bool (Validation.lubBool bty₁ bty₂) = ty₄) (h₂ : Validation.CedarType.bool (Validation.lubBool bty₂ bty₃) = ty₅) :
theorem Cedar.Thm.lub_assoc_some_some {ty₁ ty₂ ty₃ ty₄ ty₅ : Validation.CedarType} (h₁ : (ty₁ ⊔ ty₂) = some ty₄) (h₂ : (ty₂ ⊔ ty₃) = some ty₅) :
(ty₄ ⊔ ty₃) = (ty₁ ⊔ ty₅)
theorem Cedar.Thm.lubRecordType_assoc_some_some {rty₁ rty₂ rty₃ rty₄ rty₅ : List (Spec.Attr × Validation.QualifiedType)} (h₁ : Validation.lubRecordType rty₁ rty₂ = some rty₄) (h₂ : Validation.lubRecordType rty₂ rty₃ = some rty₅) :
theorem Cedar.Thm.lubQualifiedType_assoc_some_some {qty₁ qty₂ qty₃ qty₄ qty₅ : Validation.QualifiedType} (h₁ : Validation.lubQualifiedType qty₁ qty₂ = some qty₄) (h₂ : Validation.lubQualifiedType qty₂ qty₃ = some qty₅) :
theorem Cedar.Thm.lub_assoc (ty₁ ty₂ ty₃ : Validation.CedarType) :
(do let ty₄ ← ty₁ ⊔ ty₂ ty₄ ⊔ ty₃) = do let ty₄ ← ty₂ ⊔ ty₃ ty₁ ⊔ ty₄
theorem Cedar.Thm.lub_lub_fixed {ty₁ ty₂ ty₃ ty₄ : Validation.CedarType} (h₁ : (ty₁ ⊔ ty₂) = some ty₃) (h₂ : (ty₃ ⊔ ty₄) = some ty₄) :
(ty₁ ⊔ ty₄) = some ty₄
theorem Cedar.Thm.foldlM_of_lub_assoc (ty₁ ty₂ : Validation.CedarType) (tys : List Validation.CedarType) :
List.foldlM Validation.lub? ty₁ (ty₂ :: tys) = do let ty₃ ← List.foldlM Validation.lub? ty₂ tys ty₁ ⊔ ty₃