I think I've been able to puzzle out the free Lawvere theory on a collection of function symbols ought to have maps being just tuples of the free monad.
In Coq
Inductive term {A} (X: A -> nat) B :=
| var (x: B)
| roll x (Fin.t (X x) -> term X B).
Definition Mor {S} (X: S -> nat) A B := Fin.t B -> term X (Fin.t A).
And you use regular monadic composition.
My actual code uses the vector type instead but let's be simple.
But this doesn't seem quite right to me. The "free Lawvere theory" ought to be adjoint to a forgetful functor. The free monad stuff sort of works but I can't figure out the formal way to think about this. Fully generally you want something silly like a free 2-functor $\text{Dis}(\text{FinSet}) \rightarrow \text{Cat}\setminus\text{FinSet}$. Not at all sure here.
A
andX
above), and no equations? That's just a W-type. Also, it would be better to haveX : A -> Type
, i.e., replace the number with the type of that cardinality. Then, in concrete cases you ca setX a = Fin (f n)
for somef : X -> nat
. This might help. $\endgroup$