TITLE: When is a formula preserved under taking factors in a reduced product or the stalk in a Boolean product?
QUESTION [6 upvotes]: I want to know if there is a nice characterization of when a formula is preserved under taking reduced factors.
We say that a formula $\phi$ is closed under taking reduced factors if whenever $I$ is a set, $Z$ is a filter on $I$ and $\prod_{i\in I}A_{i}/Z\models\phi([(a_{i,1})_{i\in I}],...,[(a_{i,n})_{i\in I}])$, then $\{i\in I|A_{i}\models\phi(a_{i,1},...,a_{i,n})\}\in Z$. Is there a good characterization of which formulas are preserved under taking reduced factors?
We say that a formula $\phi$ is closed under taking Boolean product stalks if whenever

$X$ is a compact zero-dimensional space
$A_{x}$ is a structure for each $x\in X$
$A\subseteq\prod_{x\in X}A_{x}$ is a subalgebra where $\pi_{x}[A]=A_{x}$ whenever $\pi_{x}:\prod_{x\in X}A_{x}\rightarrow A_{x}$ is the projection.
whenever $f_{1},...,f_{n}\in A$ and $(C_{1},...,C_{n})$ is a partition of $X$ into clopen sets, then $f_{1}|_{C_{1}}\cup...\cup f_{n}|_{C_{n}}\in A$
whenever $\phi$ is a formula and $f_{1},...,f_{n}\in A$, then
$\{x\in X|A_{x}\models\phi(f_{1}(x),...,f_{n}(x))\}$ is a clopen subset of $X$,

then whenever $A\models\phi(f_{1},...,f_{n})$, then $A_{x}\models\phi(f_{1}(x),...,f_{n}(x))$ for each $x\in X$.
Is there a characterization of the formulas closed under taking Boolean product stalks? Are the formulas closed under taking Boolean product stalks precisely the formulas closed under taking reduced factors?
$\textbf{Background}$
A formula of the form $A_{1}\wedge...\wedge A_{n}\rightarrow B$ or of the form $(\neg A_{1})\vee...\vee(\neg A_{n})$ where $A_{1},...,A_{n},B$ are atomic is said to be a basic Horn formula. A formula of the form $Q_{1}x_{1}...Q_{n}x_{n}(\phi_{1}\wedge...\wedge\phi_{n})$ where $Q_{1},...,Q_{n}$ are quantifiers and $\phi_{1},...,\phi_{n}$ are basic horn formulae is said to be a Horn formula. It is a standard result that a formula is equivalent to a Horn formula if and only if whenever $A_{i}\models\phi(a_{1,i},...,a_{n,i})$ for $i\in I$ and $Z$ is a filter on $I$, then $\prod_{i\in I}A_{i}/Z\models\phi([(a_{1,i})_{i\in I}],...,[(a_{n,i})_{i\in I}])$. 
It is an exercise in Chang and Keisler that every positive sentence is preserved under taking reduced factors, but not every sentence preserved under reduced factors is a positive sentence.

REPLY [4 votes]: (Only a sketchy partial answer.)
The family of factorable formulas, is the smallest set $F$ of formulas
containing every atomic formula that is closed under conjunction,
existential and universal quantification, and the following rule:

if $\alpha(\vec x),\beta(\vec x, \vec y), \gamma(\vec x, \vec y)\in
F$ and $\models\forall \vec x \bigl(\alpha(\vec x) \rightarrow \exists \vec y
  \beta(\vec x, \vec y)\bigr)$ then $\forall \vec y   \bigl( \beta(\vec x,
  \vec y) \rightarrow  \gamma(\vec x, \vec y)\bigr) \in F.$

It is easy to see that these formulas are preserved under direct factors and direct products. I was told that these formulas are preserved by reduced products and factors, though I didn't checked this. The place I found this is R. Willard, Varieties Having Boolean Factor Congruences, J. Algebra 132 (1990) 130--153, where a slight variant (relative to a class of models) is defined.
These are intimately related to $h$-formulas, defined by the simpler scheme


atomic formulas are $h$-formulas; 
if $A$, $B$ are $h$-formulas and $x$ is a variable, then
  $(A\wedge B)$ and $(\exists xA\wedge\forall x(A\rightarrow B))$
  are $h$-formulas.


(I was informed about this family of formulas by an anonymous referee, and he cited the paper E. A. Palyutin, Categorical Horn classes, I., Algebra and Logic 19 (1980) 377--400, but I have no access to it.)
Still in the sketchy & partial vein, I didn't checked if they are actually the same fam
Finally, although not directly related, the paper by Hugo Volger, Preservation Theorems for Limits of Structures and Global Sections of Sheaves of Structures, Math. Z. 166, 27--53 (1979), might be relevant here. He gives a partial solution to the problem of characterizing sentences preserved by Boolean products.