For a term t, the set free(t) of free variables is:
t=x∈Vt a constantt=f(t1,…,tn):free(t)={x}:free(t)=∅:free(t)=i=1⋃nfree(ti)
For a formula φ, the set free(φ) of free variables is:
φ=P(t1,…,tn)φ=¬ψφ=(ψ⊙ψ′),⊙∈{∧,∨,→}φ=(∀xψ),(∃xψ):free(φ)=i=1⋃nfree(ti):free(φ)=free(ψ):free(φ)=free(ψ)∪free(ψ′):free(φ)=free(ψ)∖{x}