Terms of first-order logic #
This file defines the terms of first-order logic.
The bounded variables are denoted by #x
for x : Fin n
, and free variables are denoted by &x
for x : ξ
.
t : Semiterm L ξ n
is a (semi-)term of language L
with bounded variables of Fin n
and free variables of ξ
.
inductive
LO.FirstOrder.Semiterm
(L : LO.FirstOrder.Language)
(ξ : Type u_1)
(n : ℕ)
:
Type (max u_1 u_2)
- bvar: {L : LO.FirstOrder.Language} → {ξ : Type u_1} → {n : ℕ} → Fin n → LO.FirstOrder.Semiterm L ξ n
- fvar: {L : LO.FirstOrder.Language} → {ξ : Type u_1} → {n : ℕ} → ξ → LO.FirstOrder.Semiterm L ξ n
- func: {L : LO.FirstOrder.Language} → {ξ : Type u_1} → {n arity : ℕ} → L.Func arity → (Fin arity → LO.FirstOrder.Semiterm L ξ n) → LO.FirstOrder.Semiterm L ξ n
Instances For
Equations
- LO.FirstOrder.«term&_» = Lean.ParserDescr.node `LO.FirstOrder.«term&_» 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "&") (Lean.ParserDescr.cat `term 1024))
Instances For
Equations
- LO.FirstOrder.«term#_» = Lean.ParserDescr.node `LO.FirstOrder.«term#_» 1024 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "#") (Lean.ParserDescr.cat `term 1024))
Instances For
@[reducible, inline]
Equations
Instances For
@[reducible, inline]
Equations
Instances For
instance
LO.FirstOrder.Semiterm.instInhabited
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[Inhabited ξ]
:
Inhabited (LO.FirstOrder.Semiterm L ξ n)
Equations
- LO.FirstOrder.Semiterm.instInhabited = { default := LO.FirstOrder.Semiterm.fvar default }
def
LO.FirstOrder.Semiterm.toStr
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[(k : ℕ) → ToString (L.Func k)]
[ToString ξ]
:
LO.FirstOrder.Semiterm L ξ n → String
Equations
- (LO.FirstOrder.Semiterm.bvar x_1).toStr = "x_{" ++ toString (n - 1 - ↑x_1) ++ "}"
- (LO.FirstOrder.Semiterm.fvar x_1).toStr = "z_{" ++ toString x_1 ++ "}"
- (LO.FirstOrder.Semiterm.func c a).toStr = toString c
- (LO.FirstOrder.Semiterm.func f v).toStr = ("{" ++ toString f ++ "} \\left(" ++ String.vecToStr fun (i : Fin (n_1 + 1)) => (v i).toStr) ++ "\\right)"
Instances For
instance
LO.FirstOrder.Semiterm.instRepr
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[(k : ℕ) → ToString (L.Func k)]
[ToString ξ]
:
Repr (LO.FirstOrder.Semiterm L ξ n)
Equations
- LO.FirstOrder.Semiterm.instRepr = { reprPrec := fun (t : LO.FirstOrder.Semiterm L ξ n) (x : ℕ) => Std.Format.text t.toStr }
instance
LO.FirstOrder.Semiterm.instToString
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[(k : ℕ) → ToString (L.Func k)]
[ToString ξ]
:
ToString (LO.FirstOrder.Semiterm L ξ n)
Equations
- LO.FirstOrder.Semiterm.instToString = { toString := LO.FirstOrder.Semiterm.toStr }
def
LO.FirstOrder.Semiterm.hasDecEq
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[(k : ℕ) → DecidableEq (L.Func k)]
[DecidableEq ξ]
(t u : LO.FirstOrder.Semiterm L ξ n)
:
Equations
- One or more equations did not get rendered due to their size.
- (LO.FirstOrder.Semiterm.bvar x_2).hasDecEq (LO.FirstOrder.Semiterm.bvar y) = ⋯.mpr (decEq x_2 y)
- (LO.FirstOrder.Semiterm.bvar a).hasDecEq (LO.FirstOrder.Semiterm.fvar a_1) = isFalse ⋯
- (LO.FirstOrder.Semiterm.bvar a).hasDecEq (LO.FirstOrder.Semiterm.func a_1 a_2) = isFalse ⋯
- (LO.FirstOrder.Semiterm.fvar a).hasDecEq (LO.FirstOrder.Semiterm.bvar a_1) = isFalse ⋯
- (LO.FirstOrder.Semiterm.fvar x_2).hasDecEq (LO.FirstOrder.Semiterm.fvar y) = ⋯.mpr (decEq x_2 y)
- (LO.FirstOrder.Semiterm.fvar a).hasDecEq (LO.FirstOrder.Semiterm.func a_1 a_2) = isFalse ⋯
- (LO.FirstOrder.Semiterm.func a a_1).hasDecEq (LO.FirstOrder.Semiterm.bvar a_2) = isFalse ⋯
- (LO.FirstOrder.Semiterm.func a a_1).hasDecEq (LO.FirstOrder.Semiterm.fvar a_2) = isFalse ⋯
Instances For
instance
LO.FirstOrder.Semiterm.instDecidableEq
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[(k : ℕ) → DecidableEq (L.Func k)]
[DecidableEq ξ]
:
DecidableEq (LO.FirstOrder.Semiterm L ξ n)
Equations
- LO.FirstOrder.Semiterm.instDecidableEq = LO.FirstOrder.Semiterm.hasDecEq
def
LO.FirstOrder.Semiterm.complexity
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
:
LO.FirstOrder.Semiterm L ξ n → ℕ
Equations
- (LO.FirstOrder.Semiterm.bvar a).complexity = 0
- (LO.FirstOrder.Semiterm.fvar a).complexity = 0
- (LO.FirstOrder.Semiterm.func a v).complexity = (Finset.univ.sup fun (i : Fin arity) => (v i).complexity) + 1
Instances For
@[simp]
theorem
LO.FirstOrder.Semiterm.complexity_bvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(x : Fin n)
:
(LO.FirstOrder.Semiterm.bvar x).complexity = 0
@[simp]
theorem
LO.FirstOrder.Semiterm.complexity_fvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(x : ξ)
:
(LO.FirstOrder.Semiterm.fvar x).complexity = 0
theorem
LO.FirstOrder.Semiterm.complexity_func
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n k : ℕ}
(f : L.Func k)
(v : Fin k → LO.FirstOrder.Semiterm L ξ n)
:
(LO.FirstOrder.Semiterm.func f v).complexity = (Finset.univ.sup fun (i : Fin k) => (v i).complexity) + 1
@[simp]
theorem
LO.FirstOrder.Semiterm.complexity_func_lt
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n k : ℕ}
(f : L.Func k)
(v : Fin k → LO.FirstOrder.Semiterm L ξ n)
(i : Fin k)
:
(v i).complexity < (LO.FirstOrder.Semiterm.func f v).complexity
@[reducible, inline]
abbrev
LO.FirstOrder.Semiterm.func!
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(k : ℕ)
(f : L.Func k)
(v : Fin k → LO.FirstOrder.Semiterm L ξ n)
:
LO.FirstOrder.Semiterm L ξ n
Equations
Instances For
def
LO.FirstOrder.Semiterm.bv
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
:
LO.FirstOrder.Semiterm L ξ n → Finset (Fin n)
Equations
- (LO.FirstOrder.Semiterm.bvar a).bv = {a}
- (LO.FirstOrder.Semiterm.fvar a).bv = ∅
- (LO.FirstOrder.Semiterm.func a v).bv = Finset.univ.biUnion fun (i : Fin arity) => (v i).bv
Instances For
@[simp]
theorem
LO.FirstOrder.Semiterm.bv_bvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
{x : Fin n}
:
(LO.FirstOrder.Semiterm.bvar x).bv = {x}
@[simp]
theorem
LO.FirstOrder.Semiterm.bv_fvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
{x : ξ}
:
(LO.FirstOrder.Semiterm.fvar x).bv = ∅
theorem
LO.FirstOrder.Semiterm.bv_func
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n k : ℕ}
(f : L.Func k)
(v : Fin k → LO.FirstOrder.Semiterm L ξ n)
:
(LO.FirstOrder.Semiterm.func f v).bv = Finset.univ.biUnion fun (i : Fin k) => (v i).bv
@[simp]
theorem
LO.FirstOrder.Semiterm.bv_constant
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(f : L.Func 0)
(v : Fin 0 → LO.FirstOrder.Semiterm L ξ n)
:
(LO.FirstOrder.Semiterm.func f v).bv = ∅
def
LO.FirstOrder.Semiterm.Positive
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(t : LO.FirstOrder.Semiterm L ξ (n + 1))
:
Instances For
@[simp]
theorem
LO.FirstOrder.Semiterm.Positive.bvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
{x : Fin (n + 1)}
:
(LO.FirstOrder.Semiterm.bvar x).Positive ↔ 0 < x
@[simp]
theorem
LO.FirstOrder.Semiterm.Positive.fvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
{x : ξ}
:
(LO.FirstOrder.Semiterm.fvar x).Positive
@[simp]
theorem
LO.FirstOrder.Semiterm.Positive.func
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n k : ℕ}
(f : L.Func k)
(v : Fin k → LO.FirstOrder.Semiterm L ξ (n + 1))
:
(LO.FirstOrder.Semiterm.func f v).Positive ↔ ∀ (i : Fin k), (v i).Positive
theorem
LO.FirstOrder.Semiterm.bv_eq_empty_of_positive
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{t : LO.FirstOrder.Semiterm L ξ 1}
(ht : t.Positive)
:
def
LO.FirstOrder.Semiterm.freeVariables
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
:
LO.FirstOrder.Semiterm L ξ n → Finset ξ
Equations
- (LO.FirstOrder.Semiterm.bvar a).freeVariables = ∅
- (LO.FirstOrder.Semiterm.fvar a).freeVariables = {a}
- (LO.FirstOrder.Semiterm.func a v).freeVariables = Finset.univ.biUnion fun (i : Fin arity) => (v i).freeVariables
Instances For
@[simp]
theorem
LO.FirstOrder.Semiterm.freeVariables_bvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
{x : Fin n}
:
(LO.FirstOrder.Semiterm.bvar x).freeVariables = ∅
@[simp]
theorem
LO.FirstOrder.Semiterm.freeVariables_fvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
{x : ξ}
:
(LO.FirstOrder.Semiterm.fvar x).freeVariables = {x}
theorem
LO.FirstOrder.Semiterm.freeVariables_func
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
{k : ℕ}
(f : L.Func k)
(v : Fin k → LO.FirstOrder.Semiterm L ξ n)
:
(LO.FirstOrder.Semiterm.func f v).freeVariables = Finset.univ.biUnion fun (i : Fin k) => (v i).freeVariables
@[simp]
theorem
LO.FirstOrder.Semiterm.freeVariables_constant
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
(f : L.Func 0)
(v : Fin 0 → LO.FirstOrder.Semiterm L ξ n)
:
(LO.FirstOrder.Semiterm.func f v).freeVariables = ∅
@[simp]
theorem
LO.FirstOrder.Semiterm.freeVariables_empty
{L : LO.FirstOrder.Language}
{n : ℕ}
{ο : Type u_6}
[IsEmpty ο]
{t : LO.FirstOrder.Semiterm L ο n}
:
@[reducible, inline]
abbrev
LO.FirstOrder.Semiterm.FVar?
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
(t : LO.FirstOrder.Semiterm L ξ n)
(x : ξ)
:
Instances For
@[simp]
theorem
LO.FirstOrder.Semiterm.fvar?_bvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
(x : Fin n)
(z : ξ)
:
¬(LO.FirstOrder.Semiterm.bvar x).FVar? z
@[simp]
theorem
LO.FirstOrder.Semiterm.fvar?_fvar
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
(x z : ξ)
:
(LO.FirstOrder.Semiterm.fvar x).FVar? z ↔ x = z
@[simp]
theorem
LO.FirstOrder.Semiterm.fvar?_func
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
(x : ξ)
{k : ℕ}
(f : L.Func k)
(v : Fin k → LO.FirstOrder.Semiterm L ξ n)
:
(LO.FirstOrder.Semiterm.func f v).FVar? x ↔ ∃ (i : Fin k), (v i).FVar? x
def
LO.FirstOrder.Semiterm.lMap
{L₁ : LO.FirstOrder.Language}
{L₂ : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(Φ : L₁.Hom L₂)
:
LO.FirstOrder.Semiterm L₁ ξ n → LO.FirstOrder.Semiterm L₂ ξ n
Equations
- LO.FirstOrder.Semiterm.lMap Φ (LO.FirstOrder.Semiterm.bvar a) = LO.FirstOrder.Semiterm.bvar a
- LO.FirstOrder.Semiterm.lMap Φ (LO.FirstOrder.Semiterm.fvar a) = LO.FirstOrder.Semiterm.fvar a
- LO.FirstOrder.Semiterm.lMap Φ (LO.FirstOrder.Semiterm.func a v) = LO.FirstOrder.Semiterm.func (Φ.func a) fun (i : Fin arity) => LO.FirstOrder.Semiterm.lMap Φ (v i)
Instances For
@[simp]
theorem
LO.FirstOrder.Semiterm.lMap_bvar
{L₁ : LO.FirstOrder.Language}
{L₂ : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(Φ : L₁.Hom L₂)
(x : Fin n)
:
@[simp]
theorem
LO.FirstOrder.Semiterm.lMap_fvar
{L₁ : LO.FirstOrder.Language}
{L₂ : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(Φ : L₁.Hom L₂)
(x : ξ)
:
theorem
LO.FirstOrder.Semiterm.lMap_func
{L₁ : LO.FirstOrder.Language}
{L₂ : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(Φ : L₁.Hom L₂)
{k : ℕ}
(f : L₁.Func k)
(v : Fin k → LO.FirstOrder.Semiterm L₁ ξ n)
:
LO.FirstOrder.Semiterm.lMap Φ (LO.FirstOrder.Semiterm.func f v) = LO.FirstOrder.Semiterm.func (Φ.func f) fun (i : Fin k) => LO.FirstOrder.Semiterm.lMap Φ (v i)
@[simp]
theorem
LO.FirstOrder.Semiterm.lMap_positive
{L₁ : LO.FirstOrder.Language}
{L₂ : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
(Φ : L₁.Hom L₂)
(t : LO.FirstOrder.Semiterm L₁ ξ (n + 1))
:
(LO.FirstOrder.Semiterm.lMap Φ t).Positive ↔ t.Positive
@[simp]
theorem
LO.FirstOrder.Semiterm.freeVariables_lMap
{L₁ : LO.FirstOrder.Language}
{L₂ : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[DecidableEq ξ]
(Φ : L₁.Hom L₂)
(t : LO.FirstOrder.Semiterm L₁ ξ n)
:
(LO.FirstOrder.Semiterm.lMap Φ t).freeVariables = t.freeVariables
instance
LO.FirstOrder.Semiterm.instInhabited_1
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[L.ConstantInhabited]
:
Inhabited (LO.FirstOrder.Semiterm L ξ n)
Equations
- LO.FirstOrder.Semiterm.instInhabited_1 = { default := LO.FirstOrder.Semiterm.func default ![] }
theorem
LO.FirstOrder.Semiterm.default_def
{L : LO.FirstOrder.Language}
{ξ : Type u_1}
{n : ℕ}
[L.ConstantInhabited]
:
default = LO.FirstOrder.Semiterm.func default ![]