Definition of Modular Forms over finite Fields I'm still severely lacking in background at the moment, but I'm interested in doing something with congruence properties of modular forms (relations between coefficients of the q-expansions that hold modulo a prime).
I'm trying to compute these things using SAGE, and I'm wondering what the relation is between 
1) Taking the q-expansion of a modular form (of level $N$) defined over $\mathbb{Z}$ and then reducing the coefficients modulo $p$ ($\mathbb{Z}[[q]]\rightarrow \mathbb{F}_{p}[[q]]$). 
and
2) Taking the q-expansion of a modular form defined over $\mathbb{F}_{p}$?
I vaguely know that there is a definition of a modular form as a functor that takes in data $(E/S,\alpha_{n})$ and outputs a section of $(\omega_{E/S})^{\otimes{k}}$ or some rule that takes in $(E/{\rm Spec}(R),\alpha_{n},\omega)$ and outputs an element of $R$. So I'm pretty sure the answer is easy to get if one is comfortable with these notions, but I wouldn't trust my answer (pullback the Tate curve under some map ${\rm Spec}(\mathbb{F}_{p})\rightarrow {\rm Spec}(\mathbb{Z})$, hope this means all the formulas are reduced modulo $p$, then evaluating on the Tate curve hopefully just means reducing the coefficients modulo $p$...)
(As for the computation I'm trying to make in SAGE:
I don't think it lets me take a basis of modular forms defined over $\mathbb{Z}$:
ModularForms(1,12,ZZ).basis()
Traceback (click to the left of this block for traceback)
...
TypeError: Argument K (= Integer Ring) must be a field.
I can do it over a field, but I'm not sure how to interpret what SAGE is telling me when I plug in a finite field. If I do:
ModularForms(1,12,QQ).basis()
[
q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6),
1 + 65520/691*q + 134250480/691*q^2 + 11606736960/691*q^3 +
274945048560/691*q^4 + 3199218815520/691*q^5 + O(q^6)
]
I get denominators. If I plug in $\mathbb{F}_{p}$, where $p$ does not divide 691, then I think I just get the coefficients reduced modulo $p$:
ModularForms(1,12,GF(5)).basis()
[
1 + O(q^6),
q + q^2 + 2*q^3 + 3*q^4 + O(q^6)
]
But if I plug in 691, I'm not sure what SAGE is telling me:
ModularForms(1,12,GF(691)).basis()
[
1 + 316*q^2 + 477*q^3 + 34*q^4 + 362*q^5 + O(q^6),
q + 667*q^2 + 252*q^3 + 601*q^4 + 684*q^5 + O(q^6)
]
Thanks!
 A: This is a somewhat subtle question.  If you restrict to weights $k \geq 2$ and levels $N$ that are prime to $p$ for which the congruence subgroup you consider is torsion free, then taking modular forms with $\mathbb Z$-coeffs. and tensoring with $\mathbb F_p$ is the same as taking modular forms over $\mathbb F_p$ in the algebro-geometric sense (i.e. sections of the appropriate line bundle over the base-change to $\mathbb F_p$ of the relevant modular curve).
In the non-representable situation, things are more complicated.  You can see
a discussion of the issue in Mazur's Eisenstein ideal paper (from weight $2$ and prime level); since the torsion in $\Gamma_0(N)$ is at most $2$ and $3$ torsion,
the issues occur modulo the primes $2$ and $3$.
If $p$ divides the level, there are also complications, because the modular curve becomes reducible modulo $p$, so that in characteristic $p$, studying $q$-expansions in characteristic $p$ isn't so dispositive.  
Just to give one illustration of how things can go, you can look at section 3.3 of my paper with Frank Calegari on Elliptic curves of odd modular degree, where we discuss some of these issues in the case $p = 2$.

Often the algebro-geometric modular forms are called Katz modular forms, since their definition follows the moduli-theoretic description given in Katz's Antwerp paper on $p$-adic modular forms.  
Perhaps the greatest difference between the two worlds occurs when
$k = 1$ (even if we take $N$ prime to $p$ and $\Gamma_1(N)$ to be
torsion-free).  There can be many more Katz modular forms over $\mathbb F_p$
then there are classical wt. $1$ modular forms (i.e. the dimension can be much greater).  The possiblity of this was observed by Katz, the first examples were given by Mestre, I think, and more recently it has been studied by a lot of people, including Buzzard and Schaeffer.

As for what Sage is doing, I defer to David's answer.  
A: There are two questions here: one mathematical, one Sage-specific.
The mathematical question -- "What is the definition of mod $p$ modular forms, and what is their relation with the mod $p$ reductions of classical modular forms?" -- has already ben more or less answered in the comments. Let me just add that for weight $\ge 2$ the concepts really are exactly the same -- every mod $p$ modular form in the scheme-theoretic sense is just the reduction modulo $p$ of the $q$-expansion of a modular form with coefficients in $\mathbb{Z}$ -- but for weight 1 there are mod $p$ modular forms that aren't the reduction modulo $p$ of forms over $\mathbb{Z}$.
As for the Sage question: Sage is actually computing modular symbols mod $p$, which are just a formalism for computing the mod $p$ (compactly-supported) cohomology of modular curves. But the code for modular symbols over finite fields is old and buggy and hasn't been maintained very actively, and I wouldn't be surprised if it wasn't wholly reliable. The output you quote for weight 12 forms mod 691 looks a bit fishy to me!
