Counting generalized quantifiers #
[Fintype α]-gated specializations: counting quantifiers (most_sem,
few_sem, half_sem, the at_*_n_sem family, the exceptive
all_but_n_sem, between_n_m_sem, and the non-conservative counterexample
m_sem), plus the cardinality-based Quantity and Proportional predicates
and the bridge to model-agnostic QuantityInvariant.
Main declarations #
count—(Finset.univ.filter P).cardover aFintypecarrier.- Counting GQs (
most_sem,few_sem,half_sem,both_sem,neither_sem,at_least_n_sem,at_most_n_sem,exactly_n_sem,all_but_n_sem,between_n_m_sem,m_sem). Quantity— cardinality-based isomorphism closure.Proportional— truth-value depends only on the ratio |A∩B|/|A\B|.
Relativized counting (the maximal-generality primitive) #
countOn counts over an explicit Finset domain — decidable with no Fintype
on the carrier. The whole-carrier count is its Finset.univ specialization
(count := countOn Finset.univ). The threshold/prevalence operators (the
cross-multiplied Nat predicate thresholdGtOn and its demoted ℚ view
prevalenceOn, the analogue of Rel.edgeDensity) build on countOn.
Count of elements of s satisfying P. The Fintype-free counting primitive.
Equations
- Quantification.countOn s P = (Finset.filter P s).card
Instances For
"most" over s: strictly more R∧S than R∧¬S in s. Division-free.
mostOn Finset.univ = most_sem (mostOn_univ).
Equations
- Quantification.mostOn s R S = ((Quantification.countOn s fun (x : α) => R x ∧ S x) > Quantification.countOn s fun (x : α) => R x ∧ ¬S x)
Instances For
Threshold (≥): at least num/denom of the R's in s are S. Cross-multiplied.
Equations
- Quantification.thresholdOn s R S num denom = ((denom * Quantification.countOn s fun (x : α) => R x ∧ S x) ≥ num * Quantification.countOn s R)
Instances For
Threshold (>): more than num/denom of the R's in s are S. Cross-multiplied.
Equations
- Quantification.thresholdGtOn s R S num denom = ((denom * Quantification.countOn s fun (x : α) => R x ∧ S x) > num * Quantification.countOn s R)
Instances For
The ℚ prevalence view (analogue of Rel.edgeDensity): proportion of R-in-s
that are S. The derived numeric value; related to thresholdGtOn by
thresholdGtOn_iff_prevalenceOn.
Equations
- Quantification.prevalenceOn s R S = if Quantification.countOn s R = 0 then 0 else ↑(Quantification.countOn s fun (x : α) => R x ∧ S x) / ↑(Quantification.countOn s R)
Instances For
Equations
- Quantification.mostOn.decidable s R S = id inferInstance
Equations
- Quantification.thresholdOn.decidable s R S num denom = id inferInstance
Equations
- Quantification.thresholdGtOn.decidable s R S num denom = id inferInstance
The division-free thresholdGtOn agrees with "prevalenceOn exceeds num/denom",
justifying the demotion of the ℚ ratio to a derived view.
"More than half" is exactly "most": thresholdGtOn s R S 1 2 (more than 1/2
of the R's in s are S) coincides with mostOn s R S (strictly more
R∧S than R∧¬S). Both are division-free Nat comparisons; the bridge is
countOn_decompose. The threshold 1/2 is special because it is the cutpoint
at the 1 : 1 cell ratio.
The relativized ∀/∃ companions of Basic's whole-carrier every_sem/
some_sem/no_sem: bounded over an explicit Finset, hence decidable with no
Fintype (Finset.decidableDforallFinset). They are not duplicates of the
_sem denotations — every_sem ranges over the whole (possibly infinite)
carrier for the general GQ theory, whereas everyOn s ranges over s; the two
meet at s = Finset.univ (everyOn_univ).
s-relativized restricted universal: every R in s is S.
Equations
- Quantification.everyOn s R S = ∀ x ∈ s, R x → S x
Instances For
Equations
- Quantification.everyOn.decidable s R S = id inferInstance
Equations
- Quantification.someOn.decidable s R S = id inferInstance
Equations
- Quantification.noOn.decidable s R S = id inferInstance
Count of elements satisfying a predicate, via Finset.univ.filter.
The Finset.univ specialization of countOn.
Equations
- Quantification.count P = Quantification.countOn Finset.univ P
Instances For
Whole-carrier recovery (s = Finset.univ) #
The relativized ∀/∃ operators reduce to Basic's whole-carrier denotations
at s = univ, exhibiting them as the general layer's finite specialization.
Counting denotations #
⟦most⟧(R)(S) = |R ∩ S| > |R \ S|.
Equations
- Quantification.most_sem R S = ((Quantification.count fun (x : α) => R x ∧ S x) > Quantification.count fun (x : α) => R x ∧ ¬S x)
Instances For
⟦few⟧(R)(S) = |R ∩ S| < |R \ S|. Dual of most_sem.
Equations
- Quantification.few_sem R S = ((Quantification.count fun (x : α) => R x ∧ S x) < Quantification.count fun (x : α) => R x ∧ ¬S x)
Instances For
⟦half⟧(R)(S) = 2 * |R ∩ S| = |R|.
Equations
- Quantification.half_sem R S = ((2 * Quantification.count fun (x : α) => R x ∧ S x) = Quantification.count fun (x : α) => R x)
Instances For
⟦both⟧(R)(S) = ⟦every⟧(R)(S) ∧ |R| ≥ 2. K&S §2.3.
Equations
- Quantification.both_sem R S = (Quantification.every_sem R S ∧ {x : α | R x}.card ≥ 2)
Instances For
⟦neither⟧ = gqMeet ⟦no⟧ (|R| ≥ 2). K&S (83b).
Equations
- Quantification.neither_sem = Quantification.gqMeet Quantification.no_sem fun (R x : α → Prop) => {x : α | R x}.card ≥ 2
Instances For
⟦at least n⟧(R)(S) = |R ∩ S| ≥ n.
Equations
- Quantification.at_least_n_sem n R S = ((Quantification.count fun (x : α) => R x ∧ S x) ≥ n)
Instances For
⟦at most n⟧(R)(S) = |R ∩ S| ≤ n.
Equations
- Quantification.at_most_n_sem n R S = ((Quantification.count fun (x : α) => R x ∧ S x) ≤ n)
Instances For
⟦exactly n⟧(R)(S) = |R ∩ S| = n.
Equations
- Quantification.exactly_n_sem n R S = ((Quantification.count fun (x : α) => R x ∧ S x) = n)
Instances For
⟦all but n⟧(R)(S) = |R \ S| = n. The exceptive counterpart of
exactly_n_sem; generalizes "every" (= all but 0).
Equations
- Quantification.all_but_n_sem n R S = ((Quantification.count fun (x : α) => R x ∧ ¬S x) = n)
Instances For
⟦between n and k⟧(R)(S) = n ≤ |R ∩ S| ≤ k.
Equations
Instances For
A non-conservative quantifier for contrast: ⟦M⟧(A,B) = |A| > |B| (van de Pol et al.'s hypothetical counterpart to "most").
Equations
- Quantification.m_sem R S = ((Quantification.count fun (x : α) => R x) > Quantification.count fun (x : α) => S x)
Instances For
Instance-polymorphic: count(R∧S) = count(R∧(R∧S)) for any
DecidablePred instances.
Instance-polymorphic: count(R∧¬S) = count(R∧¬(R∧S)) for any
DecidablePred instances.
Conservativity of counting GQs #
⟦some⟧ = ⟦at least 1⟧.
⟦at most n⟧ = outerNeg ⟦at least n+1⟧.
⟦no⟧ = ⟦at most 0⟧.
⟦exactly n⟧ = ⟦at least n⟧ ⊓ ⟦at most n⟧.
⟦all but 0⟧ = ⟦every⟧.
Scope monotonicity of counting GQs #
Smoothness #
Quantity / isomorphism closure ([Mos57]) #
Cardinality-based, Fintype-gated. quantityInvariant_of_quantity and
quantity_of_quantityInvariant bridge to the model-agnostic
QuantityInvariant (in Defs.lean): the four Venn cells are the fibers of
the Bool × Bool code x ↦ (decide (R x), decide (S x)), and equal cell
cardinalities glue (Equiv.ofFiberEquiv) into a domain bijection.
Quantity / isomorphism closure: Q(A, B) depends only on the four
cardinalities |A ∩ B|, |A \ B|, |B \ A|, |M \ (A ∪ B)|.
Type-⟨1,1⟩ generalization of [Mos57]'s permutation
invariance for type-⟨1⟩ quantifiers, due to [vB84].
Equations
- One or more equations did not get rendered due to their size.
Instances For
Quantity → QuantityInvariant: cardinality-dependence implies
bijection-invariance. Each cell count of (A', B') equals the
corresponding cell count of (A, B): the bijection f maps the
(A', B')-cell into the (A, B)-cell (membership transported by the
A ∘ f ↔ A', B ∘ f ↔ B' hypotheses), so the filters have equal card.
QuantityInvariant → Quantity: bijection-invariance implies
cardinality-dependence. Equal cell cardinalities give, cell by cell, an
equivalence of cellCode fibers (Fintype.equivOfCardEq); gluing the four
over the partition of α (Equiv.ofFiberEquiv) yields a bijection f
with R₁ ∘ f ↔ R₂ and S₁ ∘ f ↔ S₂, to which hQ applies.
Quantity closure #
Quantity of concrete GQs #
Satisfies universals (counting) #
Proportional: q's truth value depends only on the ratio |A∩B|/|A\B|.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Proportional ⇒ not intersective / not monotone (witnessed counterexamples) #
The proportional determiners most, few, half are not intersective:
they fail the Existential property (felicity in there-sentences), even though
B&C's Table II labels few/half "weak". Existential q (q R S ↔ q (R∩S) ⊤)
is false for them because the truth value depends on |R∖S|, not just on |R∩S|.
Refuting it needs a domain with |α| ≥ 3 (over Fin 1/Fin 2 most is vacuously
Existential), so the witnessed statements pin α := Fin 3. half is moreover
non-monotone in scope (goes true→false as the scope grows), and most is not
symmetric.
count is independent of the chosen DecidablePred instance: any instance
equals the canonical synthesized one. Lets the classical-DecidablePred
count frozen into the counting denotations be evaluated by decide.
most is proportional, not intersective: it fails Existential. Witness over
Fin 3: R = ⊤, S = {0} gives |R∩S| = 1, |R∖S| = 2, so most R S is
false (1 > 2 fails) while most (R∩S) ⊤ is true (|R∩S| = 1 > 0).
few is proportional, not intersective: it fails Existential, despite B&C's
"weak" label. Witness over Fin 3: R = ⊤, S = {0} gives |R∩S| = 1 < |R∖S| = 2, so few R S is true while few (R∩S) ⊤ is false
(|R∩S| < |∅| = 0 is impossible).
half is proportional, not intersective: it fails Existential, despite B&C's
"weak" label. Witness over Fin 3: R = {0,1}, S = {0} gives half R S
true (2·|R∩S| = 2 = |R|) while half (R∩S) ⊤ requires |R∩S| = 0, false.
half is not scope-upward-monotone. Witness over Fin 3: R = {0,1},
S = {0} ⊆ S' = {0,1}; half R S is true (2·1 = 2 = |R|) but half R S'
is false (2·2 = 4 ≠ 2) — growing the scope flips it true→false.
half is not scope-downward-monotone. Witness over Fin 3: R = {0,1},
S = ∅ ⊆ S' = {0}; half R S' is true (2·1 = 2 = |R|) but half R S is
false (2·0 = 0 ≠ 2) — shrinking the scope flips it true→false.
half is non-monotone in scope: neither scope-upward nor scope-downward
monotone ([vdPLvM+23]).
most is not symmetric: most R S ↔ most S R fails. Witness over Fin 3:
R = {0}, S = {0,1}; most R S is true (|R∩S| = 1 > |R∖S| = 0) but
most S R is false (|S∩R| = 1 > |S∖R| = 1 fails).
Whole-carrier recovery for mostOn and inherited proportionality #
mostOn Finset.univ is the s = Finset.univ fibre of the relativized
most, matching the whole-carrier most_sem (modulo the
DecidablePred-instance bridge Finset.filter_congr_decidable). The
Proportional theorem proved for most_sem therefore transfers to it by
inheritance, not re-proof.
mostOn at the whole carrier is proportional — inherited from
most_proportional, not re-proved: at s = Finset.univ the relativized
mostOn IS most_sem.