Bounded formulas
Relabelling moved a formula from one constant domain to another along a total function. The constructions of Part 4 need the partial case. There, a formula arrives with constants drawn from a whole universe, and it has to be replanted inside one stage of a hierarchy, which can only receive the constants that happen to lie in that stage. A total function does not exist; what exists is a certificate, per occurrence, that this constant is one the target can accept.
This chapter is that certificate. BoundedFo P φ records, occurrence by occurrence, that every constant appearing in φ satisfies P. It is defined by the same case analysis as the formula it inspects, so it splits automatically under pattern matching, and no proof ever has to reason about a list of the constants of a formula. Being pure syntax, the chapter mentions neither hierarchies nor stages, and costs nothing.
The companion is monotonicity. A certificate for a narrower predicate is one for a wider predicate, which is how certificates written against different stages are brought to a common stage before being used together.
{-# OPTIONS --cubical --safe --guardedness #-} open import Base.Prelude module FOL.Manipulation.Bounding where open import FOL.Syntax using ( Term; con; var; Formula; _∈̇_; _≐_; _∧̇_; _∨̇_; _⇒̇_; ¬̇_; ⊤̇; ⊥̇ ; ∃̇_; ∀̇_; ∀̇∈; ∃̇∈ ) open import FOL.LevyHierarchy using ( Δ₀; δ-∈; δ-≐; δ-∧; δ-∨; δ-⇒; δ-¬; δ-⊤; δ-⊥; δ-∀∈; δ-∃∈ ) open import FOL.Manipulation.Relabelling using ( mapTm; mapFo ) open import Cubical.Data.Unit using ( Unit )
The certificate
A term carries a certificate when its constant satisfies the predicate; a variable carries nothing, which is recorded as the trivial datum at the right universe level. A formula's certificate is the tuple of its parts', following the constructors one for one. Bounded quantifiers carry a certificate for their bounding term as well, since that term is where a constant most often enters.
BoundedTm : ∀ {ℓk ℓp} {K : Type ℓk} (P : K → Type ℓp) {n} → Term K n → Type ℓp BoundedTm P (con c) = P c BoundedTm P (var i) = Lift Unit BoundedFo : ∀ {ℓk ℓp} {K : Type ℓk} (P : K → Type ℓp) {n} → Formula K n → Type ℓp BoundedFo P (t ∈̇ u) = BoundedTm P t × BoundedTm P u BoundedFo P (t ≐ u) = BoundedTm P t × BoundedTm P u BoundedFo P (φ ∧̇ ψ) = BoundedFo P φ × BoundedFo P ψ BoundedFo P (φ ∨̇ ψ) = BoundedFo P φ × BoundedFo P ψ BoundedFo P (φ ⇒̇ ψ) = BoundedFo P φ × BoundedFo P ψ BoundedFo P (¬̇ φ) = BoundedFo P φ BoundedFo P ⊤̇ = Lift Unit BoundedFo P ⊥̇ = Lift Unit BoundedFo P (∃̇ φ) = BoundedFo P φ BoundedFo P (∀̇ φ) = BoundedFo P φ BoundedFo P (∀̇∈ t φ) = BoundedTm P t × BoundedFo P φ BoundedFo P (∃̇∈ t φ) = BoundedTm P t × BoundedFo P φ
Monotonicity
Weakening the predicate weakens the certificate, by the same recursion. The predicate that matters later is "lies in this stage", and stages grow, so this is the lemma that lets several certificates, each written for the stage its own formula needed, be read together at one stage above them all.
module _ {ℓk ℓp ℓq} {K : Type ℓk} {P : K → Type ℓp} {Q : K → Type ℓq} (P⊆Q : (c : K) → P c → Q c) where BoundedTm-mono : ∀ {n} (t : Term K n) → BoundedTm P t → BoundedTm Q t BoundedTm-mono (con c) p = P⊆Q c p BoundedTm-mono (var i) _ = _ BoundedFo-mono : ∀ {n} (φ : Formula K n) → BoundedFo P φ → BoundedFo Q φ BoundedFo-mono (t ∈̇ u) (ht , hu) = BoundedTm-mono t ht , BoundedTm-mono u hu BoundedFo-mono (t ≐ u) (ht , hu) = BoundedTm-mono t ht , BoundedTm-mono u hu BoundedFo-mono (φ ∧̇ ψ) (hφ , hψ) = BoundedFo-mono φ hφ , BoundedFo-mono ψ hψ BoundedFo-mono (φ ∨̇ ψ) (hφ , hψ) = BoundedFo-mono φ hφ , BoundedFo-mono ψ hψ BoundedFo-mono (φ ⇒̇ ψ) (hφ , hψ) = BoundedFo-mono φ hφ , BoundedFo-mono ψ hψ BoundedFo-mono (¬̇ φ) hφ = BoundedFo-mono φ hφ BoundedFo-mono ⊤̇ _ = _ BoundedFo-mono ⊥̇ _ = _ BoundedFo-mono (∃̇ φ) hφ = BoundedFo-mono φ hφ BoundedFo-mono (∀̇ φ) hφ = BoundedFo-mono φ hφ BoundedFo-mono (∀̇∈ t φ) (ht , hφ) = BoundedTm-mono t ht , BoundedFo-mono φ hφ BoundedFo-mono (∃̇∈ t φ) (ht , hφ) = BoundedTm-mono t ht , BoundedFo-mono φ hφ
Relabelling, partially
And the payoff the certificate was for. Relabelling wanted a total function between constant domains; here there is only a partial one, defined where the predicate holds. The certificate says the predicate holds at every constant a given formula actually mentions, so the formula can be relabelled after all, occurrence by occurrence, with the certificate supplying the argument at each.
The interface is stated in the generality its user needs. Two domains, a common world they both map into, a predicate on the source, a partial map defined under it, and the equation saying the partial map agrees with the two projections. In the intended instance the source is the model's carrier, the target is a stage's member type, the world is the hierarchy, and the equation is the fact that a member of a stage, viewed as a set, is the set it was.
module Relabel {ℓk ℓk' ℓv ℓp : Level} {K : Type ℓk} {K' : Type ℓk'} {W : Type ℓv} (proj : K → W) (up : K' → W) (P : K → Type ℓp) (down : (c : K) → P c → K') (down-correct : (c : K) (p : P c) → up (down c p) ≡ proj c) where liftTm : ∀ {n} (t : Term K n) → BoundedTm P t → Term K' n liftTm (con c) p = con (down c p) liftTm (var i) _ = var i liftFo : ∀ {n} (φ : Formula K n) → BoundedFo P φ → Formula K' n liftFo (t ∈̇ u) (ht , hu) = liftTm t ht ∈̇ liftTm u hu liftFo (t ≐ u) (ht , hu) = liftTm t ht ≐ liftTm u hu liftFo (φ ∧̇ ψ) (hφ , hψ) = liftFo φ hφ ∧̇ liftFo ψ hψ liftFo (φ ∨̇ ψ) (hφ , hψ) = liftFo φ hφ ∨̇ liftFo ψ hψ liftFo (φ ⇒̇ ψ) (hφ , hψ) = liftFo φ hφ ⇒̇ liftFo ψ hψ liftFo (¬̇ φ) hφ = ¬̇ liftFo φ hφ liftFo ⊤̇ _ = ⊤̇ liftFo ⊥̇ _ = ⊥̇ liftFo (∃̇ φ) hφ = ∃̇ liftFo φ hφ liftFo (∀̇ φ) hφ = ∀̇ liftFo φ hφ liftFo (∀̇∈ t φ) (ht , hφ) = ∀̇∈ (liftTm t ht) (liftFo φ hφ) liftFo (∃̇∈ t φ) (ht , hφ) = ∃̇∈ (liftTm t ht) (liftFo φ hφ)
Correctness says the relabelling changed nothing that matters: pushing the result into the common world along one map gives the same formula as pushing the original along the other. That is the equation the two legs of an absoluteness argument meet at, and it holds occurrence by occurrence for the reason the interface demanded.
The Levy witness survives too, since relabelling touches constants and the witness never looks at them.
liftTm-correct : ∀ {n} (t : Term K n) (h : BoundedTm P t) → mapTm up (liftTm t h) ≡ mapTm proj t liftTm-correct (con c) p = cong con (down-correct c p) liftTm-correct (var i) _ = refl liftFo-correct : ∀ {n} (φ : Formula K n) (h : BoundedFo P φ) → mapFo up (liftFo φ h) ≡ mapFo proj φ liftFo-correct (t ∈̇ u) (ht , hu) = cong₂ _∈̇_ (liftTm-correct t ht) (liftTm-correct u hu) liftFo-correct (t ≐ u) (ht , hu) = cong₂ _≐_ (liftTm-correct t ht) (liftTm-correct u hu) liftFo-correct (φ ∧̇ ψ) (hφ , hψ) = cong₂ _∧̇_ (liftFo-correct φ hφ) (liftFo-correct ψ hψ) liftFo-correct (φ ∨̇ ψ) (hφ , hψ) = cong₂ _∨̇_ (liftFo-correct φ hφ) (liftFo-correct ψ hψ) liftFo-correct (φ ⇒̇ ψ) (hφ , hψ) = cong₂ _⇒̇_ (liftFo-correct φ hφ) (liftFo-correct ψ hψ) liftFo-correct (¬̇ φ) hφ = cong ¬̇_ (liftFo-correct φ hφ) liftFo-correct ⊤̇ _ = refl liftFo-correct ⊥̇ _ = refl liftFo-correct (∃̇ φ) hφ = cong ∃̇_ (liftFo-correct φ hφ) liftFo-correct (∀̇ φ) hφ = cong ∀̇_ (liftFo-correct φ hφ) liftFo-correct (∀̇∈ t φ) (ht , hφ) = cong₂ ∀̇∈ (liftTm-correct t ht) (liftFo-correct φ hφ) liftFo-correct (∃̇∈ t φ) (ht , hφ) = cong₂ ∃̇∈ (liftTm-correct t ht) (liftFo-correct φ hφ) Δ₀-liftFo : ∀ {n} {φ : Formula K n} (h : BoundedFo P φ) → Δ₀ φ → Δ₀ (liftFo φ h) Δ₀-liftFo (ht , hu) δ-∈ = δ-∈ Δ₀-liftFo (ht , hu) δ-≐ = δ-≐ Δ₀-liftFo (hφ , hψ) (δ-∧ c d) = δ-∧ (Δ₀-liftFo hφ c) (Δ₀-liftFo hψ d) Δ₀-liftFo (hφ , hψ) (δ-∨ c d) = δ-∨ (Δ₀-liftFo hφ c) (Δ₀-liftFo hψ d) Δ₀-liftFo (hφ , hψ) (δ-⇒ c d) = δ-⇒ (Δ₀-liftFo hφ c) (Δ₀-liftFo hψ d) Δ₀-liftFo hφ (δ-¬ c) = δ-¬ (Δ₀-liftFo hφ c) Δ₀-liftFo _ δ-⊤ = δ-⊤ Δ₀-liftFo _ δ-⊥ = δ-⊥ Δ₀-liftFo (ht , hφ) (δ-∀∈ c) = δ-∀∈ (Δ₀-liftFo hφ c) Δ₀-liftFo (ht , hφ) (δ-∃∈ c) = δ-∃∈ (Δ₀-liftFo hφ c)
Recap
BoundedFo is a per-occurrence certificate that a formula's constants satisfy a predicate, and BoundedFo-mono weakens it. Nothing here is about sets; the payoff is Relabel, where the certificate becomes the licence to relabel a formula into a smaller constant domain, with
liftFo-correct saying the relabelling changed nothing the meaning depends on and Δ₀-liftFo carrying the Levy witness across.