Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 290ad75

Browse files
committed
feat(model_theory/terms_and_formulas): Atomic, Quantifier-Free, and Prenex Formulas (#12557)
Provides a few induction principles for formulas Defines atomic formulas with `first_order.language.bounded_formula.is_atomic` Defines quantifier-free formulas with `first_order.language.bounded_formula.is_qf` Defines `first_order.language.bounded_formula.is_prenex` indicating that a formula is in prenex normal form.
1 parent d17ecf9 commit 290ad75

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

src/model_theory/terms_and_formulas.lean

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,68 @@ begin
503503
simp }
504504
end
505505

506+
507+
/-- An atomic formula is either equality or a relation symbol applied to terms.
508+
Note that `⊥` and `⊤` are not considered atomic in this convention. -/
509+
inductive is_atomic : L.bounded_formula α n → Prop
510+
| equal (t₁ t₂ : L.term (α ⊕ fin n)) : is_atomic (bd_equal t₁ t₂)
511+
| rel {l : ℕ} (R : L.relations l) (ts : fin l → L.term (α ⊕ fin n)) :
512+
is_atomic (R.bounded_formula ts)
513+
514+
lemma is_atomic.relabel {m : ℕ} {φ : L.bounded_formula α m} (h : φ.is_atomic)
515+
(f : α → β ⊕ (fin n)) :
516+
(φ.relabel f).is_atomic :=
517+
is_atomic.rec_on h (λ _ _, is_atomic.equal _ _) (λ _ _ _, is_atomic.rel _ _)
518+
519+
/-- A quantifier-free formula is a formula defined without quantifiers. These are all equivalent
520+
to boolean combinations of atomic formulas. -/
521+
inductive is_qf : L.bounded_formula α n → Prop
522+
| falsum : is_qf falsum
523+
| of_is_atomic {φ} (h : is_atomic φ) : is_qf φ
524+
| imp {φ₁ φ₂} (h₁ : is_qf φ₁) (h₂ : is_qf φ₂) : is_qf (φ₁.imp φ₂)
525+
526+
lemma is_atomic.is_qf {φ : L.bounded_formula α n} : is_atomic φ → is_qf φ :=
527+
is_qf.of_is_atomic
528+
529+
lemma is_qf_bot : is_qf (⊥ : L.bounded_formula α n) :=
530+
is_qf.falsum
531+
532+
lemma is_qf.not {φ : L.bounded_formula α n} (h : is_qf φ) :
533+
is_qf φ.not :=
534+
h.imp is_qf_bot
535+
536+
lemma is_qf.relabel {m : ℕ} {φ : L.bounded_formula α m} (h : φ.is_qf)
537+
(f : α → β ⊕ (fin n)) :
538+
(φ.relabel f).is_qf :=
539+
is_qf.rec_on h is_qf_bot (λ _ h, (h.relabel f).is_qf) (λ _ _ _ _, is_qf.imp)
540+
541+
/-- Indicates that a bounded formula is in prenex normal form - that is, it consists of quantifiers
542+
applied to a quantifier-free formula. -/
543+
inductive is_prenex : ∀ {n}, L.bounded_formula α n → Prop
544+
| of_is_qf {n} {φ : L.bounded_formula α n} (h : is_qf φ) : is_prenex φ
545+
| all {n} {φ : L.bounded_formula α (n + 1)} (h : is_prenex φ) : is_prenex φ.all
546+
| ex {n} {φ : L.bounded_formula α (n + 1)} (h : is_prenex φ) : is_prenex φ.ex
547+
548+
lemma is_qf.is_prenex {φ : L.bounded_formula α n} : is_qf φ → is_prenex φ :=
549+
is_prenex.of_is_qf
550+
551+
lemma is_atomic.is_prenex {φ : L.bounded_formula α n} (h : is_atomic φ) : is_prenex φ :=
552+
h.is_qf.is_prenex
553+
554+
lemma is_prenex.induction_on_all_not {P : ∀ {n}, L.bounded_formula α n → Prop}
555+
{φ : L.bounded_formula α n}
556+
(h : is_prenex φ)
557+
(hq : ∀ {m} {ψ : L.bounded_formula α m}, ψ.is_qf → P ψ)
558+
(ha : ∀ {m} {ψ : L.bounded_formula α (m + 1)}, P ψ → P ψ.all)
559+
(hn : ∀ {m} {ψ : L.bounded_formula α m}, P ψ → P ψ.not) :
560+
P φ :=
561+
is_prenex.rec_on h (λ _ _, hq) (λ _ _ _, ha) (λ _ _ _ ih, hn (ha (hn ih)))
562+
563+
lemma is_prenex.relabel {m : ℕ} {φ : L.bounded_formula α m} (h : φ.is_prenex)
564+
(f : α → β ⊕ (fin n)) :
565+
(φ.relabel f).is_prenex :=
566+
is_prenex.rec_on h (λ _ _ h, (h.relabel f).is_prenex) (λ _ _ _ h, h.all) (λ _ _ _ h, h.ex)
567+
506568
end bounded_formula
507569

508570
namespace Lhom
@@ -893,5 +955,34 @@ lemma inf_semantically_equivalent_not_sup_not :
893955
φ.inf_semantically_equivalent_not_sup_not ψ
894956
end formula
895957

958+
namespace bounded_formula
959+
960+
lemma is_qf.induction_on_sup_not {P : L.bounded_formula α n → Prop} {φ : L.bounded_formula α n}
961+
(h : is_qf φ)
962+
(hf : P (⊥ : L.bounded_formula α n))
963+
(ha : ∀ (ψ : L.bounded_formula α n), is_atomic ψ → P ψ)
964+
(hsup : ∀ {φ₁ φ₂} (h₁ : P φ₁) (h₂ : P φ₂), P (φ₁ ⊔ φ₂))
965+
(hnot : ∀ {φ} (h : P φ), P φ.not)
966+
(hse : ∀ {φ₁ φ₂ : L.bounded_formula α n}
967+
(h : Theory.semantically_equivalent ∅ φ₁ φ₂), P φ₁ ↔ P φ₂) :
968+
P φ :=
969+
is_qf.rec_on h hf ha (λ φ₁ φ₂ _ _ h1 h2,
970+
(hse (φ₁.imp_semantically_equivalent_not_sup φ₂)).2 (hsup (hnot h1) h2))
971+
972+
lemma is_qf.induction_on_inf_not {P : L.bounded_formula α n → Prop} {φ : L.bounded_formula α n}
973+
(h : is_qf φ)
974+
(hf : P (⊥ : L.bounded_formula α n))
975+
(ha : ∀ (ψ : L.bounded_formula α n), is_atomic ψ → P ψ)
976+
(hinf : ∀ {φ₁ φ₂} (h₁ : P φ₁) (h₂ : P φ₂), P (φ₁ ⊓ φ₂))
977+
(hnot : ∀ {φ} (h : P φ), P φ.not)
978+
(hse : ∀ {φ₁ φ₂ : L.bounded_formula α n}
979+
(h : Theory.semantically_equivalent ∅ φ₁ φ₂), P φ₁ ↔ P φ₂) :
980+
P φ :=
981+
h.induction_on_sup_not hf ha (λ φ₁ φ₂ h1 h2,
982+
((hse (φ₁.sup_semantically_equivalent_not_inf_not φ₂)).2 (hnot (hinf (hnot h1) (hnot h2)))))
983+
(λ _, hnot) (λ _ _, hse)
984+
985+
end bounded_formula
986+
896987
end language
897988
end first_order

0 commit comments

Comments
 (0)