Sorts #
Ground monomorphic types. They name the sort of a value in the denotational
semantics (Strata.DL.Lambda.Denote.LExprDenote) and the element types of
collection literals (LConst.mapConst, LConst.sequenceConst). Their properties, and
their decidable equality, are in Strata.DL.Lambda.LSortProps.
A sort is a ground monomorphic type — an LMonoTy with no free type
variables. We use a separate type rather than LMonoTy to avoid carrying
around proofs that a type has no type variables.
- tcons
(name : String)
(args : List LSort)
: LSort
A named type constructor applied to sort arguments.
- bitvec
(size : Nat)
: LSort
A bit vector sort of the given size.
Instances For
Equations
- Lambda.instReprLSort = { reprPrec := Lambda.instReprLSort.repr }
Equations
The Boolean sort.
Equations
- Lambda.LSort.bool = Lambda.LSort.tcons "bool" []
Instances For
The integer sort.
Equations
Instances For
The real sort.
Equations
- Lambda.LSort.real = Lambda.LSort.tcons "real" []
Instances For
The string sort.
Equations
- Lambda.LSort.string = Lambda.LSort.tcons "string" []
Instances For
The sort Sequence a of the finite sequences of a.
Equations
- a.seq = Lambda.LSort.tcons "Sequence" [a]
Instances For
Boolean equality of sorts, structurally.
Equations
- Lambda.LSort_eqb (Lambda.LSort.tcons n1 a1) (Lambda.LSort.tcons n2 a2) = (n1 == n2 && Lambda.LSort_eqb.LSort_eqb_list✝ a1 a2)
- Lambda.LSort_eqb (Lambda.LSort.bitvec s1_2) (Lambda.LSort.bitvec s2_2) = (s1_2 == s2_2)
- Lambda.LSort_eqb s1 s2 = false
Instances For
Recursion on sorts with the hypothesis on the arguments of a constructor stated by list membership.
Equations
- Lambda.LSort.rec' P htcons hbitvec (Lambda.LSort.tcons a a_1) = htcons a a_1 fun (x : Lambda.LSort) (x_1 : x ∈ a_1) => Lambda.LSort.rec' P htcons hbitvec x
- Lambda.LSort.rec' P htcons hbitvec (Lambda.LSort.bitvec a) = hbitvec a
Instances For
The monomorphic type (without type variables) naming a sort.
Equations
- (Lambda.LSort.tcons name args).toMonoTy = Lambda.LMonoTy.tcons name (Lambda.LSort.toMonoTy.map args)
- (Lambda.LSort.bitvec n).toMonoTy = Lambda.LMonoTy.bitvec n
Instances For
Equations
Instances For
Whether a sort mentions the Map type constructor anywhere. Two well-typed
constants of a sort without Map are equal exactly when they denote the same value;
map literals are not canonical (two different literals can denote the same map,
e.g. when the key sort is finite), so for them only syntactic equality is known to
imply semantic equality.
Equations
- (Lambda.LSort.tcons name args).hasMap = (name == "Map" || Lambda.LSort.hasMap.hasMapList args)
- (Lambda.LSort.bitvec n).hasMap = false
Instances For
Equations
Instances For
The sort a monomorphic type names, if it has no type variables.
Equations
- (Lambda.LMonoTy.ftvar name).toSort? = none
- (Lambda.LMonoTy.bitvec n).toSort? = some (Lambda.LSort.bitvec n)
- (Lambda.LMonoTy.tcons name args).toSort? = Option.map (Lambda.LSort.tcons name) (Lambda.LMonoTy.toSort?.toSortList? args)