Documentation

Flypitch.FOL.Syntax

Flypitch.FOL.Syntax defines first-order languages, terms, and the de Bruijn-style lifting and substitution operations on them. The lemmas in this file are the basic bookkeeping tools used throughout the later semantic and proof-theoretic developments.

def Flypitch.fol.subst_realize {S : Type u} (v : S) (x : S) (n k : ) :
S

Given a valuation v, replace the variable at index n by x.

Equations
Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[simp]
      theorem Flypitch.fol.subst_realize_lt {S : Type u} (v : S) (x : S) {n k : } (h : k < n) :
      (v[x // n]) k = v k
      @[simp]
      theorem Flypitch.fol.subst_realize_gt {S : Type u} (v : S) (x : S) {n k : } (h : n < k) :
      (v[x // n]) k = v (k - 1)
      @[simp]
      theorem Flypitch.fol.subst_realize_var_eq {S : Type u} (v : S) (x : S) (n : ) :
      (v[x // n]) n = x
      theorem Flypitch.fol.subst_realize_congr {S : Type u} {v v' : S} (hv : ∀ (k : ), v k = v' k) (x : S) (n k : ) :
      (v[x // n]) k = (v'[x // n]) k

      Pointwise-equal valuations give the same substituted valuation.

      theorem Flypitch.fol.subst_realize2_0 {S : Type u} (v : S) (x x' : S) (n k : ) :
      (v[x' // n][x // 0]) k = (v[x // 0][x' // n + 1]) k

      Commuting the substitutions at 0 and n + 1 on valuations.

      structure Flypitch.fol.Language :
      Type (u + 1)

      A first-order language is given by its function and relation symbols, indexed by arity.

      Instances For

        Nullary function symbols of a language.

        Equations
        Instances For
          inductive Flypitch.fol.preterm (L : Language) :
          Type u

          preterm L l is a partially applied term requiring l more arguments.

          Instances For
            @[reducible, inline]
            abbrev Flypitch.fol.term (L : Language) :
            Type u_1

            Closed terms.

            Equations
            Instances For
              def Flypitch.fol.apps {L : Language} {l : } :
              preterm L ldvector (term L) lterm L

              Fully apply a partially applied term to a tuple of arguments.

              Equations
              Instances For
                @[simp]
                theorem Flypitch.fol.apps_zero {L : Language} (t : term L) (ts : dvector (term L) 0) :
                apps t ts = t
                theorem Flypitch.fol.apps_eq_app {L : Language} {l : } (t : preterm L (l + 1)) (s : term L) (ts : dvector (term L) l) :
                ∃ (t' : preterm L (0 + 1)) (s' : preterm L 0), apps t (dvector.cons s ts) = t'.app s'

                Applying at least one argument produces an explicit preterm.app.

                noncomputable def Flypitch.fol.term.rec {L : Language} {C : term LSort v} (hvar : (k : ) → C &k) (hfunc : {l : } → (f : L.functions l) → (ts : dvector (term L) l) → ((t : term L) → dvector.pmem t tsC t)C (apps (preterm.func f) ts)) (t : term L) :
                C t

                Dependent recursor on terms that exposes the full argument vector of each function symbol.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def Flypitch.fol.term.elim' {L : Language} {C : Type v} (hvar : C) (hfunc : {l : } → L.functions ldvector (term L) ldvector C lC) {l : } (_t : preterm L l) (_ts : dvector (term L) l) (_ih_ts : dvector C l) :
                  C

                  Non-dependent eliminator on partially applied terms with accumulated recursive results.

                  Equations
                  Instances For
                    def Flypitch.fol.term.elim {L : Language} {C : Type v} (hvar : C) (hfunc : {l : } → L.functions ldvector (term L) ldvector C lC) (_t : term L) :
                    C

                    Non-dependent eliminator on closed terms.

                    Equations
                    Instances For
                      theorem Flypitch.fol.term.elim'_apps {L : Language} {C : Type v} (hvar : C) (hfunc : {l : } → L.functions ldvector (term L) ldvector C lC) {l : } (t : preterm L l) (ts : dvector (term L) l) :
                      elim' hvar (fun {l : } => hfunc) (apps t ts) dvector.nil dvector.nil = elim' hvar (fun {l : } => hfunc) t ts (dvector.map (elim hvar fun {l : } => hfunc) ts)

                      Compatibility of term.elim' with apps.

                      theorem Flypitch.fol.term.elim_apps {L : Language} {C : Type v} (hvar : C) (hfunc : {l : } → L.functions ldvector (term L) ldvector C lC) {l : } (f : L.functions l) (ts : dvector (term L) l) :
                      elim hvar (fun {l : } => hfunc) (apps (preterm.func f) ts) = hfunc f ts (dvector.map (elim hvar fun {l : } => hfunc) ts)

                      Compatibility of term.elim with function application.

                      @[simp]
                      theorem Flypitch.fol.apps_ne_var {L : Language} {l : } {f : L.functions l} {ts : dvector (term L) l} {k : } :

                      A fully applied function symbol can never be a variable.

                      def Flypitch.fol.lift_term_at {L : Language} {l : } :
                      preterm L lpreterm L l

                      lift_term_at t n m raises variables in t at or above m by n.

                      Equations
                      Instances For
                        def Flypitch.fol.lift_term {L : Language} {l : } :
                        preterm L lpreterm L l

                        Lift every free variable of a term by n.

                        Equations
                        Instances For
                          def Flypitch.fol.lift_term1 {L : Language} {l : } :
                          preterm L lpreterm L l

                          Lift every free variable of a term by one.

                          Equations
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              theorem Flypitch.fol.lift_term_def {L : Language} {l : } (t : preterm L l) (n : ) :
                              (t ↑' n # 0) = t n

                              lift_term is lift_term_at specialized to cutoff 0.

                              @[simp]
                              theorem Flypitch.fol.lift_term_at_zero {L : Language} {l : } (t : preterm L l) (m : ) :
                              (t ↑' 0 # m) = t
                              @[simp]
                              theorem Flypitch.fol.lift_term_at_apps {L : Language} {l : } (t : preterm L l) (ts : dvector (term L) l) (n m : ) :
                              (apps t ts ↑' n # m) = apps (t ↑' n # m) (dvector.map (fun (x : preterm L 0) => x ↑' n # m) ts)
                              def Flypitch.fol.subst_term {L : Language} {l : } :
                              preterm L lterm Lpreterm L l

                              Substitute s for variable n, lowering higher variables by one.

                              Equations
                              Instances For
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[simp]
                                  theorem Flypitch.fol.subst_term_var_lt {L : Language} (s : term L) {k n : } (h : k < n) :
                                  &k[s // n] = &k
                                  @[simp]
                                  theorem Flypitch.fol.subst_term_var_gt {L : Language} (s : term L) {k n : } (h : n < k) :
                                  &k[s // n] = &(k - 1)
                                  @[simp]
                                  theorem Flypitch.fol.subst_term_var_eq {L : Language} (s : term L) (n : ) :
                                  &n[s // n] = s ↑' n # 0
                                  @[simp]
                                  theorem Flypitch.fol.subst_term_apps {L : Language} {l : } (t : preterm L l) (ts : dvector (term L) l) (s : term L) (n : ) :
                                  apps t ts[s // n] = apps (t[s // n]) (dvector.map (fun (x : preterm L 0) => x[s // n]) ts)
                                  @[simp]
                                  theorem Flypitch.fol.lift_term1_lift_term_at {L : Language} {l : } (t : preterm L l) (n m : ) :
                                  (t ↑' n # m) 1 = t 1 ↑' n # m + 1
                                  @[simp]
                                  theorem Flypitch.fol.lift_term_succ {L : Language} {l : } (t : preterm L l) (n : ) :
                                  (t n) 1 = t (n + 1)
                                  @[simp]
                                  theorem Flypitch.fol.lift_term_zero {L : Language} {l : } (t : preterm L l) :
                                  t 0 = t
                                  theorem Flypitch.fol.lift_term_at2_small {L : Language} {l : } (t : preterm L l) (n n' : ) {m m' : } :
                                  m' m → ((t ↑' n # m) ↑' n' # m') = (t ↑' n' # m') ↑' n # m + n'

                                  Commute two lifts when the second cutoff is no larger than the first.

                                  theorem Flypitch.fol.lift_term_at2_medium {L : Language} {l : } (t : preterm L l) {n : } (n' : ) {m m' : } :
                                  m m'm' m + n → ((t ↑' n # m) ↑' n' # m') = t ↑' n + n' # m

                                  Collapse two lifts when the second cutoff lies inside the first lifted block.

                                  theorem Flypitch.fol.lift_term2_medium {L : Language} {l : } (t : preterm L l) {n : } (n' : ) {m' : } (h : m' n) :
                                  (t n ↑' n' # m') = t (n + n')

                                  Global version of lift_term_at2_medium.

                                  theorem Flypitch.fol.lift_term2 {L : Language} {l : } (t : preterm L l) (n n' : ) :
                                  (t n) n' = t (n + n')

                                  Successive global lifts add their shift amounts.

                                  theorem Flypitch.fol.lift_term_at2_eq {L : Language} {l : } (t : preterm L l) (n n' m : ) :
                                  ((t ↑' n # m) ↑' n' # m + n) = t ↑' n + n' # m

                                  Special case of lift_term_at2_medium at the top of the lifted block.

                                  theorem Flypitch.fol.lift_term_at2_large {L : Language} {l : } (t : preterm L l) {n : } (n' : ) {m m' : } (h : m + n m') :
                                  ((t ↑' n # m) ↑' n' # m') = (t ↑' n' # m' - n) ↑' n # m

                                  Commute two lifts when the second cutoff lies strictly above the first lifted block.

                                  theorem Flypitch.fol.lift_at_subst_term_large {L : Language} {l : } (t : preterm L l) (s : term L) {n₁ : } (n₂ : ) {m : } :
                                  m n₁ → (t ↑' n₂ # m)[s // n₁ + n₂] = t[s // n₁] ↑' n₂ # m

                                  Substituting above the lift cutoff commutes with lifting.

                                  theorem Flypitch.fol.lift_subst_term_large {L : Language} {l : } (t : preterm L l) (s : term L) (n₁ n₂ : ) :
                                  t n₂[s // n₁ + n₂] = (t[s // n₁]) n₂

                                  Global lifting commutes with substitution above the lifted block.

                                  theorem Flypitch.fol.lift_subst_term_large' {L : Language} {l : } (t : preterm L l) (s : term L) (n₁ n₂ : ) :
                                  t n₂[s // n₂ + n₁] = (t[s // n₁]) n₂

                                  Commuted-index version of lift_subst_term_large.

                                  theorem Flypitch.fol.lift_at_subst_term_medium {L : Language} {l : } (t : preterm L l) (s : term L) {n₁ n₂ m : } :
                                  m n₂n₂ m + n₁ → (t ↑' n₁ + 1 # m)[s // n₂] = t ↑' n₁ # m

                                  Substituting inside the lifted block lowers the lift amount by one.

                                  theorem Flypitch.fol.lift_subst_term_medium {L : Language} {l : } (t : preterm L l) (s : term L) (n₁ n₂ : ) :
                                  t (n₁ + n₂ + 1)[s // n₁] = t (n₁ + n₂)

                                  Global version of lift_at_subst_term_medium.

                                  theorem Flypitch.fol.lift_at_subst_term_eq {L : Language} {l : } (t : preterm L l) (s : term L) (n : ) :
                                  (t ↑' 1 # n)[s // n] = t

                                  Lifting once and substituting at the cutoff cancels out.

                                  theorem Flypitch.fol.subst_term2 {L : Language} {l : } (t : preterm L l) (s₁ s₂ : term L) (n₁ n₂ : ) :
                                  t[s₁ // n₁][s₂ // n₁ + n₂] = t[s₂ // n₁ + n₂ + 1][s₁[s₂ // n₂] // n₁]

                                  Composition law for two substitutions into a term.

                                  @[simp]
                                  theorem Flypitch.fol.lift_term1_subst_shift {L : Language} {l : } (t : preterm L l) (s : term L) (n : ) :
                                  t 1[s // n + 1] = (t[s // n]) 1
                                  @[simp]
                                  theorem Flypitch.fol.lift_term1_subst_term {L : Language} {l : } (t : preterm L l) (s : term L) :
                                  t 1[s // 0] = t

                                  Lifting once and then substituting at 0 recovers the original term.

                                  @[simp]
                                  theorem Flypitch.fol.lift_at_subst_term_small0 {L : Language} {l : } (t : preterm L l) (s : term L) (n m : ) :
                                  (t ↑' n # m + 1)[s ↑' n # m // 0] = t[s // 0] ↑' n # m

                                  Special case of lift_at_subst_term_small at variable 0.

                                  theorem Flypitch.fol.lift_at_subst_term_small {L : Language} {l : } (t : preterm L l) (s : term L) (n₁ n₂ m : ) :
                                  (t ↑' n₁ # m + n₂ + 1)[s ↑' n₁ # m // n₂] = t[s // n₂] ↑' n₁ # m + n₂

                                  Substituting below the lift cutoff commutes with lifting the substituted term.

                                  @[simp]
                                  theorem Flypitch.fol.subst_term2_zero {L : Language} {l : } (t : preterm L l) (s₁ s₂ : term L) (n : ) :
                                  t[s₁ // 0][s₂ // n] = t[s₂ // n + 1][s₁[s₂ // n] // 0]

                                  Specialization of subst_term2 with the first substitution at variable 0.