Basics on First-Order Structures #
This file defines first-order languages and structures in the style of the Flypitch project, as well as several important maps between structures.
Main Definitions #
- A
FirstOrder.Languagedefines a language as a pair of functions from the natural numbers toType l. One sendsnto the type ofn-ary functions, and the other sendsnto the type ofn-ary relations. - A
FirstOrder.Language.Structureinterprets the symbols of a givenFirstOrder.Languagein the context of a given type. - A
FirstOrder.Language.Hom, denotedM →[L] N, is a map from theL-structureMto theL-structureNthat commutes with the interpretations of functions, and which preserves the interpretations of relations (although only in the forward direction). - A
FirstOrder.Language.Embedding, denotedM ↪[L] N, is an embedding from theL-structureMto theL-structureNthat commutes with the interpretations of functions, and which preserves the interpretations of relations in both directions. - A
FirstOrder.Language.Equiv, denotedM ≃[L] N, is an equivalence from theL-structureMto theL-structureNthat commutes with the interpretations of functions, and which preserves the interpretations of relations in both directions.
References #
For the Flypitch project:
- [J. Han, F. van Doorn, A formal proof of the independence of the continuum hypothesis] [flypitch_cpp]
- [J. Han, F. van Doorn, A formalization of forcing and the unprovability of the continuum hypothesis][flypitch_itp]
Languages and Structures #
A first-order language consists of a type of functions of every natural-number arity and a type of relations of every natural-number arity.
- Functions : ℕ → Type u
For every arity, a
Type uof functions of that arity - Relations : ℕ → Type v
For every arity, a
Type vof relations of that arity
Instances For
A language is relational when it has no function symbols.
Instances For
A language is algebraic when it has no relation symbols.
Instances For
The empty language has no symbols.
Instances For
The sum of two languages consists of the disjoint union of their symbols.
Instances For
The type of constants in a given language.
Instances For
The type of symbols in a given language.
Instances For
The cardinality of a language is the cardinality of its type of symbols.
Instances For
Passes a DecidableEq instance on a type of function symbols through the Language
constructor. Despite the fact that this is proven by inferInstance, it is still needed -
see the examples in ModelTheory/Ring/Basic.
Passes a DecidableEq instance on a type of relation symbols through the Language
constructor. Despite the fact that this is proven by inferInstance, it is still needed -
see the examples in ModelTheory/Ring/Basic.
A first-order structure on a type M consists of interpretations of all the symbols in a given
language. Each function of arity n is interpreted as a function sending tuples of length n
(modeled as (Fin n → M)) to M, and a relation of arity n is a function from tuples of length
n to Prop.
- funMap {n : ℕ} : L.Functions n → (Fin n → M) → M
Interpretation of the function symbols
Interpretation of the relation symbols
Instances
Used for defining FirstOrder.Language.Theory.ModelType.instInhabited.
Instances For
Maps #
A homomorphism between first-order structures is a function that commutes with the interpretations of functions and maps tuples in one structure where a given relation is true to tuples in the second structure where that relation is still true.
- toFun : M → N
The underlying function of a homomorphism of structures
- map_fun' {n : ℕ} (f : L.Functions n) (x : Fin n → M) : self.toFun (Structure.funMap f x) = Structure.funMap f (self.toFun ∘ x)
The homomorphism commutes with the interpretations of the function symbols
- map_rel' {n : ℕ} (r : L.Relations n) (x : Fin n → M) : Structure.RelMap r x → Structure.RelMap r (self.toFun ∘ x)
The homomorphism sends related elements to related elements
Instances For
A homomorphism between first-order structures is a function that commutes with the interpretations of functions and maps tuples in one structure where a given relation is true to tuples in the second structure where that relation is still true.
Instances For
An embedding of first-order structures is an embedding that commutes with the interpretations of functions and relations.
- toFun : M → N
- map_fun' {n : ℕ} (f : L.Functions n) (x : Fin n → M) : self.toFun (Structure.funMap f x) = Structure.funMap f (self.toFun ∘ x)
The homomorphism commutes with the interpretations of the function symbols
- map_rel' {n : ℕ} (r : L.Relations n) (x : Fin n → M) : Structure.RelMap r (self.toFun ∘ x) ↔ Structure.RelMap r x
The homomorphism sends related elements to related elements
Instances For
An embedding of first-order structures is an embedding that commutes with the interpretations of functions and relations.
Instances For
An equivalence of first-order structures is an equivalence that commutes with the interpretations of functions and relations.
- toFun : M → N
- invFun : N → M
- map_fun' {n : ℕ} (f : L.Functions n) (x : Fin n → M) : self.toFun (Structure.funMap f x) = Structure.funMap f (self.toFun ∘ x)
The homomorphism commutes with the interpretations of the function symbols
- map_rel' {n : ℕ} (r : L.Relations n) (x : Fin n → M) : Structure.RelMap r (self.toFun ∘ x) ↔ Structure.RelMap r x
The homomorphism sends related elements to related elements
Instances For
An equivalence of first-order structures is an equivalence that commutes with the interpretations of functions and relations.
Instances For
Interpretation of a constant symbol
Instances For
HomClass L F M N states that F is a type of L-homomorphisms. You should extend this
typeclass when you extend FirstOrder.Language.Hom.
- map_fun (φ : F) {n : ℕ} (f : L.Functions n) (x : Fin n → M) : φ (Structure.funMap f x) = Structure.funMap f (⇑φ ∘ x)
The homomorphism commutes with the interpretations of the function symbols
- map_rel (φ : F) {n : ℕ} (r : L.Relations n) (x : Fin n → M) : Structure.RelMap r x → Structure.RelMap r (⇑φ ∘ x)
The homomorphism sends related elements to related elements
Instances
StrongHomClass L F M N states that F is a type of L-homomorphisms which preserve
relations in both directions.
- map_fun (φ : F) {n : ℕ} (f : L.Functions n) (x : Fin n → M) : φ (Structure.funMap f x) = Structure.funMap f (⇑φ ∘ x)
The homomorphism commutes with the interpretations of the function symbols
- map_rel (φ : F) {n : ℕ} (r : L.Relations n) (x : Fin n → M) : Structure.RelMap r (⇑φ ∘ x) ↔ Structure.RelMap r x
The homomorphism sends related elements to related elements
Instances
Not an instance to avoid a loop.
The identity map from a structure to itself.
Instances For
In an algebraic language, any injective homomorphism is an embedding.
Instances For
The identity embedding from a structure to itself.
Instances For
Composition of first-order embeddings is associative.
Any element of an injective StrongHomClass can be realized as a first order embedding.
Instances For
The identity equivalence from a structure to itself.
Instances For
Any element of a bijective StrongHomClass can be realized as a first order isomorphism.
Instances For
Any type can be made uniquely into a structure over the empty language.
Instances For
Makes a Language.empty.Hom out of any function.
This is only needed because there is no instance of FunLike (M → N) M N, and thus no instance of
Language.empty.HomClass M N.
Instances For
A structure induced by a bijection.
Instances For
A bijection as a first-order isomorphism with the induced structure on the codomain.