Documentation

Mathlib.ModelTheory.Syntax

Basics on First-Order Syntax #

This file defines first-order terms, formulas, sentences, and theories in a style inspired by the Flypitch project.

Main Definitions #

Implementation Notes #

References #

For the Flypitch project:

inductive FirstOrder.Language.Term (L : FirstOrder.Language) (α : Type u') :
Type (max u u')

A term on α is either a variable indexed by an element of α or a function symbol applied to simpler terms.

Instances For

    Relabels a term's variables along a bijection.

    Equations
    Instances For

      Restricts a term to use only a set of the given variables.

      Equations
      Instances For

        The representation of a constant symbol as a term.

        Equations
        Instances For

          Applies a unary function to a term.

          Equations
          Instances For

            Applies a binary function to two terms.

            Equations
            Instances For

              Sends a term with constants to a term with extra variables.

              Equations
              Instances For
                @[simp]
                @[simp]
                theorem FirstOrder.Language.Term.constantsVarsEquiv_symm_apply {L : FirstOrder.Language} {α : Type u'} {γ : Type u_3} :
                ∀ (a : FirstOrder.Language.Term L (γ α)), FirstOrder.Language.Term.constantsVarsEquiv.symm a = FirstOrder.Language.Term.varsToConstants a

                A bijection between terms with constants and terms with extra variables.

                Equations
                • FirstOrder.Language.Term.constantsVarsEquiv = { toFun := FirstOrder.Language.Term.constantsToVars, invFun := FirstOrder.Language.Term.varsToConstants, left_inv := , right_inv := }
                Instances For

                  A bijection between terms with constants and terms with extra variables.

                  Equations
                  Instances For
                    @[simp]
                    @[simp]
                    theorem FirstOrder.Language.Term.constantsVarsEquivLeft_symm_apply {L : FirstOrder.Language} {α : Type u'} {β : Type v'} {γ : Type u_3} (t : FirstOrder.Language.Term L ((γ α) β)) :
                    FirstOrder.Language.Term.constantsVarsEquivLeft.symm t = FirstOrder.Language.Term.varsToConstants (FirstOrder.Language.Term.relabel ((Equiv.sumAssoc γ α β)) t)
                    Equations
                    Equations

                    Raises all of the Fin-indexed variables of a term greater than or equal to m by n'.

                    Equations
                    Instances For

                      Maps a term's symbols along a language equivalence.

                      Equations
                      Instances For
                        inductive FirstOrder.Language.BoundedFormula (L : FirstOrder.Language) (α : Type u') :
                        Type (max u v u')

                        BoundedFormula α n is the type of formulas with free variables indexed by α and up to n additional free variables.

                        Instances For
                          @[reducible]
                          def FirstOrder.Language.Formula (L : FirstOrder.Language) (α : Type u') :
                          Type (max u v u')

                          Formula α is the type of formulas with all free variables indexed by α.

                          Equations
                          Instances For
                            @[reducible]

                            A sentence is a formula with no free variables.

                            Equations
                            Instances For
                              @[reducible]

                              A theory is a set of sentences.

                              Equations
                              Instances For

                                Applies a relation to terms as a bounded formula.

                                Equations
                                Instances For

                                  Applies a unary relation to a term as a bounded formula.

                                  Equations
                                  Instances For

                                    Applies a binary relation to two terms as a bounded formula.

                                    Equations
                                    Instances For

                                      The equality of two terms as a bounded formula.

                                      Equations
                                      Instances For

                                        Applies a relation to terms as a bounded formula.

                                        Equations
                                        Instances For

                                          Applies a unary relation to a term as a formula.

                                          Equations
                                          Instances For

                                            Applies a binary relation to two terms as a formula.

                                            Equations
                                            Instances For

                                              The equality of two terms as a first-order formula.

                                              Equations
                                              Instances For
                                                Equations
                                                • FirstOrder.Language.BoundedFormula.instInhabitedBoundedFormula = { default := FirstOrder.Language.BoundedFormula.falsum }
                                                Equations
                                                • FirstOrder.Language.BoundedFormula.instBotBoundedFormula = { bot := FirstOrder.Language.BoundedFormula.falsum }
                                                @[match_pattern]

                                                The negation of a bounded formula is also a bounded formula.

                                                Equations
                                                Instances For
                                                  Equations
                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Equations
                                                  • One or more equations did not get rendered due to their size.

                                                  Casts L.BoundedFormula α m as L.BoundedFormula α n, where m ≤ n.

                                                  Equations
                                                  Instances For

                                                    Restricts a bounded formula to only use a particular set of free variables.

                                                    Instances For
                                                      def FirstOrder.Language.BoundedFormula.mapTermRel {L : FirstOrder.Language} {L' : FirstOrder.Language} {α : Type u'} {β : Type v'} {g : } (ft : (n : ) → FirstOrder.Language.Term L (α Fin n)FirstOrder.Language.Term L' (β Fin (g n))) (fr : (n : ) → L.Relations nL'.Relations n) (h : (n : ) → FirstOrder.Language.BoundedFormula L' β (g (n + 1))FirstOrder.Language.BoundedFormula L' β (g n + 1)) {n : } :

                                                      Maps bounded formulas along a map of terms and a map of relations.

                                                      Equations
                                                      Instances For

                                                        Raises all of the Fin-indexed variables of a formula greater than or equal to m by n'.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          @[simp]
                                                          theorem FirstOrder.Language.BoundedFormula.mapTermRel_mapTermRel {L : FirstOrder.Language} {L' : FirstOrder.Language} {α : Type u'} {β : Type v'} {γ : Type u_3} {L'' : FirstOrder.Language} (ft : (n : ) → FirstOrder.Language.Term L (α Fin n)FirstOrder.Language.Term L' (β Fin n)) (fr : (n : ) → L.Relations nL'.Relations n) (ft' : (n : ) → FirstOrder.Language.Term L' (β Fin n)FirstOrder.Language.Term L'' (γ Fin n)) (fr' : (n : ) → L'.Relations nL''.Relations n) {n : } (φ : FirstOrder.Language.BoundedFormula L α n) :
                                                          FirstOrder.Language.BoundedFormula.mapTermRel ft' fr' (fun (x : ) => id) (FirstOrder.Language.BoundedFormula.mapTermRel ft fr (fun (x : ) => id) φ) = FirstOrder.Language.BoundedFormula.mapTermRel (fun (x : ) => ft' x ft x) (fun (x : ) => fr' x fr x) (fun (x : ) => id) φ
                                                          @[simp]
                                                          theorem FirstOrder.Language.BoundedFormula.mapTermRel_id_id_id {L : FirstOrder.Language} {α : Type u'} {n : } (φ : FirstOrder.Language.BoundedFormula L α n) :
                                                          FirstOrder.Language.BoundedFormula.mapTermRel (fun (x : ) => id) (fun (x : ) => id) (fun (x : ) => id) φ = φ
                                                          @[simp]
                                                          theorem FirstOrder.Language.BoundedFormula.mapTermRelEquiv_symm_apply {L : FirstOrder.Language} {L' : FirstOrder.Language} {α : Type u'} {β : Type v'} (ft : (n : ) → FirstOrder.Language.Term L (α Fin n) FirstOrder.Language.Term L' (β Fin n)) (fr : (n : ) → L.Relations n L'.Relations n) {n : } :
                                                          ∀ (a : FirstOrder.Language.BoundedFormula L' β n), (FirstOrder.Language.BoundedFormula.mapTermRelEquiv ft fr).symm a = FirstOrder.Language.BoundedFormula.mapTermRel (fun (n : ) => (ft n).symm) (fun (n : ) => (fr n).symm) (fun (x : ) => id) a
                                                          @[simp]
                                                          theorem FirstOrder.Language.BoundedFormula.mapTermRelEquiv_apply {L : FirstOrder.Language} {L' : FirstOrder.Language} {α : Type u'} {β : Type v'} (ft : (n : ) → FirstOrder.Language.Term L (α Fin n) FirstOrder.Language.Term L' (β Fin n)) (fr : (n : ) → L.Relations n L'.Relations n) {n : } :
                                                          ∀ (a : FirstOrder.Language.BoundedFormula L α n), (FirstOrder.Language.BoundedFormula.mapTermRelEquiv ft fr) a = FirstOrder.Language.BoundedFormula.mapTermRel (fun (n : ) => (ft n)) (fun (n : ) => (fr n)) (fun (x : ) => id) a

                                                          An equivalence of bounded formulas given by an equivalence of terms and an equivalence of relations.

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            def FirstOrder.Language.BoundedFormula.relabelAux {α : Type u'} {β : Type v'} {n : } (g : αβ Fin n) (k : ) :
                                                            α Fin kβ Fin (n + k)

                                                            A function to help relabel the variables in bounded formulas.

                                                            Equations
                                                            Instances For
                                                              @[simp]
                                                              theorem FirstOrder.Language.BoundedFormula.sum_elim_comp_relabelAux {M : Type w} {α : Type u'} {β : Type v'} {n : } {m : } {g : αβ Fin n} {v : βM} {xs : Fin (n + m)M} :

                                                              Relabels a bounded formula's variables along a particular function.

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For

                                                                Relabels a bounded formula's free variables along a bijection.

                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  @[simp]
                                                                  theorem FirstOrder.Language.BoundedFormula.relabel_falsum {L : FirstOrder.Language} {α : Type u'} {β : Type v'} {n : } (g : αβ Fin n) {k : } :
                                                                  FirstOrder.Language.BoundedFormula.relabel g FirstOrder.Language.BoundedFormula.falsum = FirstOrder.Language.BoundedFormula.falsum

                                                                  Substitutes the variables in a given formula with terms.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For

                                                                    A bijection sending formulas with constants to formulas with extra variables.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For

                                                                      Turns the extra variables of a bounded formula into free variables.

                                                                      Equations
                                                                      Instances For

                                                                        take the disjunction of a finite set of formulas

                                                                        Equations
                                                                        Instances For

                                                                          take the conjunction of a finite set of formulas

                                                                          Equations
                                                                          Instances For

                                                                            An atomic formula is either equality or a relation symbol applied to terms. Note that and are not considered atomic in this convention.

                                                                            Instances For

                                                                              A quantifier-free formula is a formula defined without quantifiers. These are all equivalent to boolean combinations of atomic formulas.

                                                                              Instances For

                                                                                An auxiliary operation to FirstOrder.Language.BoundedFormula.toPrenex. If φ is quantifier-free and ψ is in prenex normal form, then φ.toPrenexImpRight ψ is a prenex normal form for φ.imp ψ.

                                                                                Instances For

                                                                                  An auxiliary operation to FirstOrder.Language.BoundedFormula.toPrenex. If φ and ψ are in prenex normal form, then φ.toPrenexImp ψ is a prenex normal form for φ.imp ψ.

                                                                                  Instances For

                                                                                    Maps a bounded formula's symbols along a language map.

                                                                                    Equations
                                                                                    Instances For

                                                                                      Maps a bounded formula's symbols along a language equivalence.

                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For

                                                                                        Relabels a formula's variables along a particular function.

                                                                                        Equations
                                                                                        Instances For

                                                                                          The graph of a function as a first-order formula.

                                                                                          Equations
                                                                                          Instances For
                                                                                            @[inline, reducible]

                                                                                            The implication between formulas, as a formula.

                                                                                            Equations
                                                                                            • FirstOrder.Language.Formula.imp = FirstOrder.Language.BoundedFormula.imp
                                                                                            Instances For
                                                                                              noncomputable def FirstOrder.Language.Formula.iAlls {L : FirstOrder.Language} {α : Type u'} {β : Type v'} {γ : Type u_3} [Finite γ] (f : αβ γ) (φ : FirstOrder.Language.Formula L α) :

                                                                                              Given a map f : α → β ⊕ γ, iAlls f φ transforms a L.Formula α into a L.Formula β by renaming variables with the map f and then universally quantifying over all variables Sum.inr _.

                                                                                              Equations
                                                                                              • One or more equations did not get rendered due to their size.
                                                                                              Instances For
                                                                                                noncomputable def FirstOrder.Language.Formula.iExs {L : FirstOrder.Language} {α : Type u'} {β : Type v'} {γ : Type u_3} [Finite γ] (f : αβ γ) (φ : FirstOrder.Language.Formula L α) :

                                                                                                Given a map f : α → β ⊕ γ, iExs f φ transforms a L.Formula α into a L.Formula β by renaming variables with the map f and then universally quantifying over all variables Sum.inr _.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For
                                                                                                  @[inline, reducible]

                                                                                                  The biimplication between formulas, as a formula.

                                                                                                  Equations
                                                                                                  Instances For

                                                                                                    A bijection sending formulas to sentences with constants.

                                                                                                    Equations
                                                                                                    Instances For
                                                                                                      theorem FirstOrder.Language.Formula.equivSentence_not {L : FirstOrder.Language} {α : Type u'} (φ : FirstOrder.Language.Formula L α) :
                                                                                                      FirstOrder.Language.Formula.equivSentence (FirstOrder.Language.Formula.not φ) = FirstOrder.Language.Formula.not (FirstOrder.Language.Formula.equivSentence φ)
                                                                                                      theorem FirstOrder.Language.Formula.equivSentence_inf {L : FirstOrder.Language} {α : Type u'} (φ : FirstOrder.Language.Formula L α) (ψ : FirstOrder.Language.Formula L α) :
                                                                                                      FirstOrder.Language.Formula.equivSentence (φ ψ) = FirstOrder.Language.Formula.equivSentence φ FirstOrder.Language.Formula.equivSentence ψ

                                                                                                      The sentence indicating that a basic relation symbol is reflexive.

                                                                                                      Equations
                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                      Instances For

                                                                                                        The sentence indicating that a basic relation symbol is irreflexive.

                                                                                                        Equations
                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                        Instances For

                                                                                                          The sentence indicating that a basic relation symbol is symmetric.

                                                                                                          Equations
                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                          Instances For

                                                                                                            The sentence indicating that a basic relation symbol is antisymmetric.

                                                                                                            Equations
                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                            Instances For

                                                                                                              The sentence indicating that a basic relation symbol is transitive.

                                                                                                              Equations
                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                              Instances For

                                                                                                                The sentence indicating that a basic relation symbol is total.

                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                Instances For

                                                                                                                  A sentence indicating that a structure has n distinct elements.

                                                                                                                  Equations
                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                  Instances For

                                                                                                                    A theory indicating that each of a set of constants is distinct.

                                                                                                                    Equations
                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                    Instances For