Function application, typed #
A function's index is the curried arrow α → β → γ, the SMT sort (-> α β γ). A function term
applies directly, f a b : Env (Term γ), or through apply/apply2/apply3, or
applyN f (.cons a (.last b)) at any arity. Fewer arguments than the arity is a partial
application, at the remaining function index.
Applications flatten: applying a term that is already an application appends to its arguments, so all these spellings build the same flat term, which needs no higher-order logic.
Application of a single argument, leaving any remaining ones unapplied.
Needs a higher-order logic; Term.apply and Term.applyN are ordinary application.
Equations
- f.applyHo arg = Cvc.Untyped.Term.applyHo f arg
Instances For
Fun's operators whose result's sort is a type variable.
- applyHo
[Ω]
{β : Type}
[ToTyp β]
(α : Typ)
(f : Term (α.function (Typ?.typ (Typ.of β))).Denote)
(arg : Term α.Denote)
: OnAny β
Application of a single argument, leaving any remaining ones unapplied.
Needs a higher-order logic;
Term.applyandTerm.applyNare ordinary application.
Instances For
Applying any number of arguments #
Arguments taking a function of index φ down to a result of index β, at least one.
Built with last and cons: .cons a (.last b) is a then b.
- terms : Cvc.Untyped.Terms
Instances For
The arguments' terms, sort-erased and in order, as the sort-erased Term.applyN takes them.
Equations
- args.toUntyped = Cvc.Typed.Term.Args.terms✝ args
Instances For
The arguments' terms, sort-erased and in order, as the sort-erased Term.applyN takes them.
Instances For
Equations
- Cvc.Typed.Term.instCoeFunForallForallEnv = { coe := fun (f : Cvc.Typed.Term (α → β)) (arg : Cvc.Typed.Term α) => f.applyN (Cvc.Typed.Term.Args.last arg) }
Applies a function to two arguments.
Equations
- f.apply2 fst snd = f.applyN (Cvc.Typed.Term.Args.cons fst (Cvc.Typed.Term.Args.last snd))
Instances For
Applies a function to three arguments.
Equations
- f.apply3 fst snd thd = f.applyN (Cvc.Typed.Term.Args.cons fst (Cvc.Typed.Term.Args.cons snd (Cvc.Typed.Term.Args.last thd)))
Instances For
Viewing an application #
The arguments' sorts come as a list of Typs, from which the function's index is computed, and
matching on the list refines both: .apply [.int, .bool] f (.cons x (.last b)) gives
f : Term (Int → Bool → τ.Denote), x : Term Int and b : Term Bool.
The same arguments as a Term.Args, so that a viewed application can be rebuilt.
Equations
Instances For
An uninterpreted function's application, of sort τ, taken apart one level.
- apply
[Ω]
{τ : Typ}
(doms : List Typ)
(f : Term (Typ.arrows doms τ.Denote))
(args : Args doms)
: View.Apply τ
f a₁ … aₙ, fully applied.
Instances For
Takes a function application of sort τ apart one level, none for any other term.
Also none when an argument's sort is one no Typ describes.
Equations
- One or more equations did not get rendered due to their size.