Skip to content

refactor(FirstOrder): abstract hierarchy over operators#838

Open
00sqh wants to merge 1 commit into
FormalizedFormalLogic:masterfrom
00sqh:operator-levy-hierarchy
Open

refactor(FirstOrder): abstract hierarchy over operators#838
00sqh wants to merge 1 commit into
FormalizedFormalLogic:masterfrom
00sqh:operator-levy-hierarchy

Conversation

@00sqh

@00sqh 00sqh commented Jul 8, 2026

Copy link
Copy Markdown

Partially addresses #663.

This PR abstracts the hierarchy machinery from the arithmetic hierarchy into an operator-parametric hierarchy.

A technical point is that two additional abstraction classes are introduced:

  • OperatorSmall, for operators whose instances already belong to the relevant hierarchy levels.
  • OperatorRewPreimage, for operators whose bounded formulas can be inverted through rewriting.

The old arithmetic hierarchy did not need these classes because < was hardcoded and Lean could unfold it as an atomic formula. For an
arbitrary Semiformula.Operator R, R.operator v may be composite, so the needed smallness and rewriting-preimage assumptions are recorded
explicitly.

This PR does not yet rewrite the hierarchy machinery in FirstOrder/Arithmetic/Definability, nor does it add the corresponding definability
machinery for set theory.

The set-theoretic definability part may not be a straightforward copy-paste from arithmetic. To get analogous definability machinery in set
theory, we may need additional tools involving rudimentary functions, which may be somewhat tricky to formalize. That is left for future work.

If the current part looks acceptable, I will continue working on this.

@SnO2WMaN SnO2WMaN requested a review from iehality July 8, 2026 10:14
Comment on lines +392 to +408
⟨by
generalize hq : (∀⁰[R.operator ![#0, t]] φ) = ψ
intro H
induction H <;> try simp [LO.FirstOrder.ball, LO.FirstOrder.bexs] at hq
case ball φ t pt hp ih =>
rcases hq with ⟨_, rfl⟩
assumption
case all hp ih =>
rcases hq with rfl
exact (imp_iff.mp hp).2
case pi s _ _ hp ih =>
rcases hq with rfl
exact (imp_iff.mp hp).2.accum _
case dummy_sigma hp _ =>
rcases hq with rfl
exact (imp_iff.mp hp).2.accum _,
by intro hp; exact hp.ball ht⟩

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is much clearer to use by constructor ... instead of ⟨by ..., by ...⟩ for long proof.


namespace LO.FirstOrder

namespace OperatorHierarchy

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think OperatorHierarchy is bit misleading. How about using Bounding instead of Operator in general?

Comment on lines +287 to +293
class OperatorRewPreimage (R : Semiformula.Operator L 2) (ξ₁ ξ₂ : Type*) : Prop where
operator_preimage {n₁ n₂ : ℕ} (ω : Rew L ξ₁ n₁ ξ₂ n₂)
{φ : Semiformula L ξ₁ (n₁ + 1)}
{t : Semiterm L ξ₂ (n₂ + 1)} :
ω.q ▹ φ = R.operator ![#0, t] →
∃ u : Semiterm L ξ₁ (n₁ + 1),
ω.q u = t ∧ φ = R.operator ![#0, u]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using general characterization Operator.SymbolLike like

class Operator.SymbolLike (o : Operator L k) (ξ₁ ξ₂) : Prop where
  symbolLike : ∀ ω : Rel L ξ₁ n₁ ξ₂, n₂, ω ▹ φ = o.operator v → ∃ w, φ = o.operator w  ∧ ∀ i, ω (w i) = v i

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants