Nullable constructors, sort-erased #
cvc5's Nullable is the Option sort: a value is either nullable.null or nullable.some v.
Unlike a declared datatype, Srt.nullable gives the same sort every time for the same element sort.
It is a datatype underneath, so a nullable value is an APPLY_CONSTRUCTOR term.
Constructors #
The null value of the nullable sort over the element sort elm.
Equations
- Cvc.Untyped.Term.mkNull elm = do let srt ← elm.nullable Cvc.runUnsafe✝ fun (tm : cvc5.TermManager) => tm.mkNullableNull srt
Instances For
The nullable value holding elem, nullable.some elem.
Equations
- elem.nullableSome = Cvc.runUnsafe✝ fun (tm : cvc5.TermManager) => tm.mkNullableSome elem
Instances For
The element the nullable term nullable holds, nullable.val.
Equations
- nullable.nullableVal = Cvc.runUnsafe✝ fun (tm : cvc5.TermManager) => tm.mkNullableVal nullable
Instances For
Whether the nullable term nullable is null, nullable.is_null.
Equations
- nullable.nullableIsNull = Cvc.runUnsafe✝ fun (tm : cvc5.TermManager) => tm.mkNullableIsNull nullable
Instances For
Whether the nullable term nullable holds an element, nullable.is_some.
Equations
- nullable.nullableIsSome = Cvc.runUnsafe✝ fun (tm : cvc5.TermManager) => tm.mkNullableIsSome nullable
Instances For
Values #
A nullable value is the constructor applied to nothing or to one element, so it is read off the term's kind and children. Unlike a set or a sequence, this works on a built term as well as on a model's answer.
The element a nullable term denotes, or none if it denotes the null value.
Fails unless the term is built by a nullable constructor (see isNullableValue): a declared
constant of nullable sort, for instance, is not.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Whether a term is built by a nullable constructor, nullable.null or nullable.some.
That is what getNullableElem? needs. Being nullable-sorted is not enough: a declared constant of
nullable sort is built by neither.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The nullable term denoting an optional value.
Equations
Instances For
The optional value a nullable term denotes.
Equations
- term.getNullableValue = do let __do_lift ← term.getNullableElem? match __do_lift with | none => pure none | some elem => some <$> elem.extractValue
Instances For
Equations
- Cvc.Untyped.Term.instValueToTermOption = { valueToTerm := fun [Cvc.Ω] => Cvc.Untyped.Term.mkNullableValue }
Equations
- Cvc.Untyped.Term.instTermToValueOption = { termToValue := fun [Cvc.Ω] => Cvc.Untyped.Term.getNullableValue }