FormalConjecturesForMathlib/ModelTheory/Decidability.lean
Explanation legend Lean4 Domain Explanation Language (L4DEL)
L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.
- L4DEL
- Lean4 Domain Explanation Language
Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.
Project sources: Pinned project documentation, Formal Conjectures paper, arXiv v1
9 declarations, 0 contain sorry, 0 declared as axioms
Recursive and decidable theories
Mathlib's FirstOrder.Language.Theory is an arbitrary set of sentences, which need not be
closed under logical consequence. Two computability notions are therefore distinct:
Tis recursive if membership inTis computable: there is an algorithm which, given a sentenceφ, decides whetherφ ∈ T. This is a property of the set of axioms.Tis decidable if the set of consequences{φ | T ⊨ᵇ φ}is recursive: there is an algorithm which decides whetherφholds in every model ofT. This only depends on the consequences ofT, so it is invariant under replacingTby a logically equivalent set of axioms (FirstOrder.Language.Theory.isDecidable_congr).
The two notions agree when T is closed under consequence, in particular for the complete
theory L.completeTheory M of a structure M
(FirstOrder.Language.Theory.isDecidable_completeTheory_iff).
Both notions use the Gödel numbering of sentences from
FormalConjecturesForMathlib.ModelTheory.Encoding and the notion of a computable function
ℕ → Bool from Mathlib's computability library. As usual, they are relative to the chosen
encoding of the symbols of L. For a language with finitely many symbols, all injective
encodings of the symbols give the same notions.
Main declarations
FirstOrder.Language.Theory.IsRecursive: membership in the set of sentences is computable.FirstOrder.Language.Theory.IsDecidable: the set of consequences is recursive.FirstOrder.Language.Theory.isDecidable_iff_isRecursive: for a theory closed under consequence, the two notions agree.
Imported by 1 file
- def
FirstOrder.Language.Theory.IsRecursiveDocumented declaration: IsRecursive line 61 sourceSource documentation
A set of sentences
Tis recursive if there is a computable functionf : ℕ → Boolsuch that, for every sentenceφ,freturnstrueon the Gödel number ofφif and only ifφ ∈ T.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
FirstOrder.Language,Encodable,Sigma,Nat,FirstOrder.Language.Functions,FirstOrder.Language.Relations,FirstOrder.Language.TheoryProof uses:
Exists,Bool,And,Computable,FirstOrder.Language.Sentence,Iff,Eq,Encodable.encode,Empty,OfNat.ofNat,Bool.true,Membership.mem8 instances, coercions and auxiliary constants left out.
def IsRecursive (T : L.Theory) : Prop := …
- def
FirstOrder.Language.Theory.IsDecidableDocumented declaration: IsDecidable line 67 sourceSource documentation
A theory
Tis decidable if the set of its consequences{φ | T ⊨ᵇ φ}is recursive: there is an algorithm which, given a sentenceφ, decides whetherφholds in every model ofT.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
FirstOrder.Language,Encodable,Sigma,Nat,FirstOrder.Language.Functions,FirstOrder.Language.Relations,FirstOrder.Language.TheoryProof uses: FirstOrder.Language.Theory.IsRecursive,
Set.ofPred,FirstOrder.Language.Sentence,FirstOrder.Language.Theory.ModelsBoundedFormula,Empty,OfNat.ofNat1 instances, coercions and auxiliary constants left out.
def IsDecidable (T : L.Theory) : Prop := …
- theorem
FirstOrder.Language.Theory.isRecursive_emptyThe empty set of sentences is recursive line 73 sourceSource documentation
The empty set of sentences is recursive.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
FirstOrder.Language,Encodable,Sigma,Nat,FirstOrder.Language.Functions,FirstOrder.Language.Relations, FirstOrder.Language.Theory.IsRecursive,EmptyCollection.emptyCollection,FirstOrder.Language.Theory,FirstOrder.Language.SentenceProof uses:
Exists.intro,Bool,And,Computable,Iff,Eq,Encodable.encode,Empty,OfNat.ofNat,Bool.true,Membership.mem,Bool.false,And.intro,Computable.const,of_eq_true,Eq.trans,False,True,congr,congrArgand 2 more11 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
theorem isRecursive_empty : (∅ : L.Theory).IsRecursive := …
Mentions: FirstOrder.Language.Theory.IsRecursive
- theorem
FirstOrder.Language.Theory.isRecursive_univThe set of all sentences is recursive line 77 sourceSource documentation
The set of all sentences is recursive.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
FirstOrder.Language,Encodable,Sigma,Nat,FirstOrder.Language.Functions,FirstOrder.Language.Relations, FirstOrder.Language.Theory.IsRecursive,Set.univ,FirstOrder.Language.SentenceProof uses:
Exists.intro,Bool,And,Computable,Iff,Eq,Encodable.encode,Empty,OfNat.ofNat,Bool.true,Membership.mem,FirstOrder.Language.Theory,And.intro,Computable.const,of_eq_true,Eq.trans,True,congr,congrArg,eq_selfand 1 more9 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
theorem isRecursive_univ : IsRecursive (Set.univ : L.Theory) := …
Mentions: FirstOrder.Language.Theory.IsRecursive
- theorem
FirstOrder.Language.Theory.IsRecursive.complThe complement of a recursive set of sentences is recursive line 81 sourceSource documentation
The complement of a recursive set of sentences is recursive.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
FirstOrder.Language,Encodable,Sigma,Nat,FirstOrder.Language.Functions,FirstOrder.Language.Relations,FirstOrder.Language.Theory, FirstOrder.Language.Theory.IsRecursive,Compl.compl,FirstOrder.Language.SentenceProof uses:
Bool,And,Computable,Iff,Eq,Encodable.encode,Empty,OfNat.ofNat,Bool.true,Membership.mem,Exists.intro,Bool.not,And.intro,Computable.of_eq,cond,Bool.false,Computable.cond,Computable.const,Eq.refl,Eq.symmand 22 more14 instances, coercions and auxiliary constants left out.
Tactic trace: 12 steps
Open to load the checked before-and-after goal states.
theorem IsRecursive.compl (hT : T.IsRecursive) : Tᶜ.IsRecursive := by …
- theorem
FirstOrder.Language.Theory.isDecidable_congrDecidability only depends on the consequences of a theory line 93 sourceSource documentation
Decidability only depends on the consequences of a theory. In particular, logically equivalent sets of axioms are decidable together.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
FirstOrder.Language,Encodable,Sigma,Nat,FirstOrder.Language.Functions,FirstOrder.Language.Relations,FirstOrder.Language.Theory,FirstOrder.Language.Sentence,Iff,FirstOrder.Language.Theory.ModelsBoundedFormula,Empty,OfNat.ofNat, FirstOrder.Language.Theory.IsDecidableProof uses:
id,Eq.mpr, FirstOrder.Language.Theory.IsRecursive,Set.ofPred,FirstOrder.Language.BoundedFormula,Eq,congrArg,Set,Set.ext,Iff.rfl2 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
theorem isDecidable_congr (h : ∀ φ : L.Sentence, T ⊨ᵇ φ ↔ T' ⊨ᵇ φ) : T.IsDecidable ↔ T'.IsDecidable := by … - theorem
FirstOrder.Language.Theory.isDecidable_iff_isRecursiveFor a theory closed under consequence, decidability is the same as recursiveness line 99 sourceSource documentation
For a theory closed under consequence, decidability is the same as recursiveness.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
FirstOrder.Language,Encodable,Sigma,Nat,FirstOrder.Language.Functions,FirstOrder.Language.Relations,FirstOrder.Language.Theory,FirstOrder.Language.Sentence,FirstOrder.Language.Theory.ModelsBoundedFormula,Empty,OfNat.ofNat,Membership.mem,Iff, FirstOrder.Language.Theory.IsDecidable, FirstOrder.Language.Theory.IsRecursiveProof uses:
id,Eq.mpr,Set.ofPred,Eq,congrArg,Set,Set.ext,Iff.intro,FirstOrder.Language.Theory.models_sentence_of_mem,Iff.rfl4 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
theorem isDecidable_iff_isRecursive (hT : ∀ φ : L.Sentence, T ⊨ᵇ φ → φ ∈ T) : T.IsDecidable ↔ T.IsRecursive := by … - theorem
FirstOrder.Language.Theory.isDecidable_completeTheory_iffThe complete theory of a structureMcontains all its consequences, so it is decidable if and only if membership in it is computable line 106 sourceSource documentation
The complete theory of a structure
Mcontains all its consequences, so it is decidable if and only if membership in it is computable.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
FirstOrder.Language,Encodable,Sigma,Nat,FirstOrder.Language.Functions,FirstOrder.Language.Relations,FirstOrder.Language.Structure,Nonempty,Iff, FirstOrder.Language.Theory.IsDecidable,FirstOrder.Language.completeTheory, FirstOrder.Language.Theory.IsRecursiveProof uses: FirstOrder.Language.Theory.isDecidable_iff_isRecursive,
FirstOrder.Language.Sentence,FirstOrder.Language.Theory.ModelsBoundedFormula,Empty,OfNat.ofNat,Iff.mpr,Membership.mem,FirstOrder.Language.Theory,FirstOrder.Language.Sentence.Realize,FirstOrder.Language.mem_completeTheory,FirstOrder.Language.Theory.ModelsBoundedFormula.realize_sentence3 instances, coercions and auxiliary constants left out.
theorem isDecidable_completeTheory_iff (M : Type*) [L.Structure M] [Nonempty M] : (L.completeTheory M).IsDecidable ↔ (L.completeTheory M).IsRecursive := …Mentions: FirstOrder.Language.Theory.IsDecidable, FirstOrder.Language.Theory.IsRecursive
- theorem
FirstOrder.Language.Theory.isDecidable_univThe inconsistent theory of all sentences is decidable line 111 sourceSource documentation
The inconsistent theory of all sentences is decidable.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
FirstOrder.Language,Encodable,Sigma,Nat,FirstOrder.Language.Functions,FirstOrder.Language.Relations, FirstOrder.Language.Theory.IsDecidable,Set.univ,FirstOrder.Language.SentenceProof uses:
Iff.mpr, FirstOrder.Language.Theory.IsRecursive, FirstOrder.Language.Theory.isDecidable_iff_isRecursive,FirstOrder.Language.Theory.ModelsBoundedFormula,Empty,OfNat.ofNat,Set.mem_univ, FirstOrder.Language.Theory.isRecursive_univ1 instances, coercions and auxiliary constants left out.
theorem isDecidable_univ : IsDecidable (Set.univ : L.Theory) := …
Mentions: FirstOrder.Language.Theory.IsDecidable