This file defines an API for construcing well-formed Terms. In this basic implementation, the factory functions perform only basic partial evaluation---constant folding along with a few other rewrites. In an optimized implementation, the factory functions would include more rewrite rules, and share a cache of partially cannonicalized terms that have been constructed so far.
The factory functions are total. If given well-formed and type-correct arguments, a factory function will return a well-formed and type-correct output. Otherwise, the output is an arbitrary term.
This design lets us minimize the number of error paths in the overall specification of symbolic compilation, which makes for nicer code and proofs, and it more closely tracks the specification of the concrete evaluator.
See Compiler.lean to see how the symbolic compiler uses this API.
Equations
Instances For
Equations
- Cedar.SymCC.Factory.«term⊙_» = Lean.ParserDescr.node `Cedar.SymCC.Factory.«term⊙_» 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "⊙") (Lean.ParserDescr.cat `term 0))
Instances For
Equations
- Cedar.SymCC.Factory.setOf ts ty = Cedar.SymCC.Term.set (Cedar.Data.Set.make ts) ty
Instances For
Equations
Instances For
Equations
- Cedar.SymCC.Factory.tagOf entity tag = Cedar.SymCC.Term.record (Cedar.SymCC.EntityTag.mk entity tag)
Instances For
Equations
- Cedar.SymCC.Factory.not (Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool b)) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool !b)
- Cedar.SymCC.Factory.not (Cedar.SymCC.Term.app Cedar.SymCC.Op.not [t'] retTy) = t'
- Cedar.SymCC.Factory.not x✝ = Cedar.SymCC.Term.app Cedar.SymCC.Op.not [x✝] Cedar.SymCC.TermType.bool
Instances For
Equations
- Cedar.SymCC.Factory.opposites x✝ (Cedar.SymCC.Term.app Cedar.SymCC.Op.not [t₂] retTy) = decide (x✝ = t₂)
- Cedar.SymCC.Factory.opposites (Cedar.SymCC.Term.app Cedar.SymCC.Op.not [t₁] retTy) x✝ = decide (t₁ = x✝)
- Cedar.SymCC.Factory.opposites x✝¹ x✝ = false
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- Cedar.SymCC.Factory.eq t₁'.some t₂'.some = Cedar.SymCC.Factory.eq.simplify t₁' t₂'
- Cedar.SymCC.Factory.eq a.some (Cedar.SymCC.Term.none a_1) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool false)
- Cedar.SymCC.Factory.eq (Cedar.SymCC.Term.none a) a_1.some = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool false)
- Cedar.SymCC.Factory.eq t₁ t₂ = Cedar.SymCC.Factory.eq.simplify t₁ t₂
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Cedar.SymCC.Factory.ite t₁ t₂'.some t₃'.some = (Cedar.SymCC.Factory.ite.simplify t₁ t₂' t₃').some
- Cedar.SymCC.Factory.ite t₁ t₂ t₃ = Cedar.SymCC.Factory.ite.simplify t₁ t₂ t₃
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.app (Cedar.SymCC.UnaryFunction.uuf f) x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.uuf f) [x✝] f.out
Instances For
Equations
- Cedar.SymCC.Factory.bvneg (Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bitvec b)) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bitvec b.neg)
- Cedar.SymCC.Factory.bvneg (Cedar.SymCC.Term.app Cedar.SymCC.Op.bvneg [t] retTy) = t
- Cedar.SymCC.Factory.bvneg x✝ = Cedar.SymCC.Term.app Cedar.SymCC.Op.bvneg [x✝] x✝.typeOf
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
- Cedar.SymCC.Factory.bvshl = Cedar.SymCC.Factory.bvapp Cedar.SymCC.Op.bvshl fun {n : Nat} (b₁ b₂ : BitVec n) => b₁ <<< b₂
Instances For
Equations
- Cedar.SymCC.Factory.bvlshr = Cedar.SymCC.Factory.bvapp Cedar.SymCC.Op.bvlshr fun {n : Nat} (b₁ b₂ : BitVec n) => b₁ >>> b₂
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.bvcmp op fn t₁ t₂ = Cedar.SymCC.Term.app op [t₁, t₂] Cedar.SymCC.TermType.bool
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.bvso op fn t₁ t₂ = Cedar.SymCC.Term.app op [t₁, t₂] Cedar.SymCC.TermType.bool
Instances For
Equations
- Cedar.SymCC.Factory.bvsaddo = Cedar.SymCC.Factory.bvso Cedar.SymCC.Op.bvsaddo fun (x1 x2 : Int) => x1 + x2
Instances For
Equations
- Cedar.SymCC.Factory.bvssubo = Cedar.SymCC.Factory.bvso Cedar.SymCC.Op.bvssubo fun (x1 x2 : Int) => x1 - x2
Instances For
Equations
- Cedar.SymCC.Factory.bvsmulo = Cedar.SymCC.Factory.bvso Cedar.SymCC.Op.bvsmulo fun (x1 x2 : Int) => x1 * x2
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.zero_extend n (Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bitvec b₁)) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bitvec (BitVec.zeroExtend (n + n_1) b₁))
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.set.member t (Cedar.SymCC.Term.set (Cedar.Data.Set.mk []) eltsTy) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool false)
- Cedar.SymCC.Factory.set.member t ts = Cedar.SymCC.Term.app Cedar.SymCC.Op.set.member [t, ts] Cedar.SymCC.TermType.bool
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.set.inter ts₁ ts₂ = if ts₁ = ts₂ then ts₁ else Cedar.SymCC.Term.app Cedar.SymCC.Op.set.inter [ts₁, ts₂] ts₁.typeOf
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.set.isEmpty (Cedar.SymCC.Term.set s eltsTy) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool s.isEmpty)
Instances For
Equations
Instances For
Equations
- Cedar.SymCC.Factory.option.get t.some = t
- Cedar.SymCC.Factory.option.get x✝ = match x✝.typeOf with | ty.option => Cedar.SymCC.Term.app Cedar.SymCC.Op.option.get [x✝] ty | x => x✝
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.record.get (Cedar.SymCC.Term.record r) a = match r.find? a with | some tₐ => tₐ | x => Cedar.SymCC.Term.record r
Instances For
Equations
Instances For
Equations
- Cedar.SymCC.Factory.ext.decimal.val (Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.ext (Cedar.Spec.Ext.decimal d))) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bitvec (Int64.toBitVec d))
- Cedar.SymCC.Factory.ext.decimal.val x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.decimal.val) [x✝] (Cedar.SymCC.TermType.bitvec 64)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.ext.ipaddr.isV4 x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.ipaddr.isV4) [x✝] Cedar.SymCC.TermType.bool
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.ext.ipaddr.addrV4 x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.ipaddr.addrV4) [x✝] (Cedar.SymCC.TermType.bitvec 32)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.ext.ipaddr.prefixV4 x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.ipaddr.prefixV4) [x✝] (Cedar.SymCC.TermType.bitvec 5).option
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.ext.ipaddr.addrV6 x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.ipaddr.addrV6) [x✝] (Cedar.SymCC.TermType.bitvec 128)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.ext.ipaddr.prefixV6 x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.ipaddr.prefixV6) [x✝] (Cedar.SymCC.TermType.bitvec 7).option
Instances For
Equations
- Cedar.SymCC.Factory.ext.datetime.val (Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.ext (Cedar.Spec.Ext.datetime d))) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bitvec d.val.toBitVec)
- Cedar.SymCC.Factory.ext.datetime.val x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.datetime.val) [x✝] (Cedar.SymCC.TermType.bitvec 64)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.ext.datetime.ofBitVec x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.datetime.ofBitVec) [x✝] (Cedar.SymCC.TermType.ext Cedar.Validation.ExtType.datetime)
Instances For
Equations
- Cedar.SymCC.Factory.ext.duration.val (Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.ext (Cedar.Spec.Ext.duration d))) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bitvec d.val.toBitVec)
- Cedar.SymCC.Factory.ext.duration.val x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.duration.val) [x✝] (Cedar.SymCC.TermType.bitvec 64)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Cedar.SymCC.Factory.ext.duration.ofBitVec x✝ = Cedar.SymCC.Term.app (Cedar.SymCC.Op.ext Cedar.SymCC.ExtOp.duration.ofBitVec) [x✝] (Cedar.SymCC.TermType.ext Cedar.Validation.ExtType.duration)
Instances For
Equations
- Cedar.SymCC.Factory.isNone (Cedar.SymCC.Term.none a) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool true)
- Cedar.SymCC.Factory.isNone a.some = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool false)
- Cedar.SymCC.Factory.isNone (Cedar.SymCC.Term.app Cedar.SymCC.Op.ite [head, a.some, a_1.some] retTy) = Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool false)
- Cedar.SymCC.Factory.isNone (Cedar.SymCC.Term.app Cedar.SymCC.Op.ite [g, a.some, Cedar.SymCC.Term.none a_1] retTy) = Cedar.SymCC.Factory.not g
- Cedar.SymCC.Factory.isNone (Cedar.SymCC.Term.app Cedar.SymCC.Op.ite [g, Cedar.SymCC.Term.none a, a_1.some] retTy) = g
- Cedar.SymCC.Factory.isNone x✝ = match x✝.typeOf with | ty.option => Cedar.SymCC.Factory.eq x✝ (Cedar.SymCC.Term.none ty) | x => Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool false)
Instances For
Instances For
Equations
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Cedar.SymCC.Factory.anyTrue f ts = List.foldl (fun (acc t : Cedar.SymCC.Term) => Cedar.SymCC.Factory.or (f t) acc) (Cedar.SymCC.Term.prim (Cedar.SymCC.TermPrim.bool false)) ts