Documentation

Cedar.Thm.SymCC.Compiler.WellTyped

This file contains theorems saying that compile succeeds with the correct term type on well-typed expressions.

States the symbolic compiler succeeds on a typed expression tx and produces a term t with the corresponding type.

Equations
Instances For

    A stronger version of CompileWellTyped that also includes well-formedness of the term

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Cedar.Thm.ofRecordType_preserves_attr {rty : Validation.RecordType} {attr : Spec.Attr} {qty : Validation.Qualified Validation.CedarType} {ty : Validation.CedarType} (hattr_exists : Data.Map.find? rty attr = some qty) (hattr_ty : qty.getType = ty) :
      (attr_ty : SymCC.TermType), (Data.Map.mk (SymCC.TermType.ofRecordType rty.1)).find? attr = some attr_ty match attr_ty with | attr_ty'.option => SymCC.TermType.ofType ty = attr_ty' ¬qty.isRequired = true | x => SymCC.TermType.ofType ty = attr_ty qty.isRequired = true

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

      theorem Cedar.Thm.compile_well_typed_ite {a b c : Validation.TypedExpr} {ty : Validation.CedarType} {Γ : Validation.TypeEnv} {εnv : SymCC.SymEnv} (iha : CompileWellTypedAndWF a εnv) (ihb : CompileWellTypedAndWF b εnv) (ihc : CompileWellTypedAndWF c εnv) (hcond_ite : CompileWellTypedCondition (a.ite b c ty) Γ εnv) :
      CompileWellTyped (a.ite b c ty) εnv

      Combined case for or and and

      Similar to compileApp₂_wf_types, but for compile

      Since we have the nice lemma compileApp₂_wf_types, it's enough to prove that compile of a binaryApp succeeds.

      theorem Cedar.Thm.compile_well_typed_getAttr {expr : Validation.TypedExpr} {attr : Spec.Attr} {ty : Validation.CedarType} {Γ : Validation.TypeEnv} {εnv : SymCC.SymEnv} (ihexpr : CompileWellTypedAndWF expr εnv) (hcond : CompileWellTypedCondition (expr.getAttr attr ty) Γ εnv) :
      CompileWellTyped (expr.getAttr attr ty) εnv
      theorem Cedar.Thm.compile_well_typed_hasAttr {expr : Validation.TypedExpr} {attr : Spec.Attr} {ty : Validation.CedarType} {Γ : Validation.TypeEnv} {εnv : SymCC.SymEnv} (ihexpr : CompileWellTypedAndWF expr εnv) (hcond : CompileWellTypedCondition (expr.hasAttr attr ty) Γ εnv) :
      CompileWellTyped (expr.hasAttr attr ty) εnv
      @[irreducible]

      Compiling a well-typed expression should produce a term of the corresponding TermType, assuming that the expression is well-formed in the symbolic environment.