File: Mathlib/ModelTheory/Algebra/Ring/Basic.lean

full_name: FirstOrder.ringFunc.one
code: /-- The type of Ring functions, to be used in the definition of the language of rings.
It contains the operations (+,*,-,0,1) -/
inductive ringFunc : ℕ → Type
  | add : ringFunc 2
  | mul : ringFunc 2
  | neg : ringFunc 1
  | zero : ringFunc 0
  | one : ringFunc 0
  deriving DecidableEq
goal: FirstOrder.ringFunc 0

full_name: FirstOrder.ringFunc.add
code: /-- The type of Ring functions, to be used in the definition of the language of rings.
It contains the operations (+,*,-,0,1) -/
inductive ringFunc : ℕ → Type
  | add : ringFunc 2
  | mul : ringFunc 2
  | neg : ringFunc 1
  | zero : ringFunc 0
  | one : ringFunc 0
  deriving DecidableEq
goal: FirstOrder.ringFunc 2

full_name: FirstOrder.ringFunc.neg
code: /-- The type of Ring functions, to be used in the definition of the language of rings.
It contains the operations (+,*,-,0,1) -/
inductive ringFunc : ℕ → Type
  | add : ringFunc 2
  | mul : ringFunc 2
  | neg : ringFunc 1
  | zero : ringFunc 0
  | one : ringFunc 0
  deriving DecidableEq
goal: FirstOrder.ringFunc 1

full_name: FirstOrder.ringFunc.mul
code: /-- The type of Ring functions, to be used in the definition of the language of rings.
It contains the operations (+,*,-,0,1) -/
inductive ringFunc : ℕ → Type
  | add : ringFunc 2
  | mul : ringFunc 2
  | neg : ringFunc 1
  | zero : ringFunc 0
  | one : ringFunc 0
  deriving DecidableEq
goal: FirstOrder.ringFunc 2

full_name: FirstOrder.ringFunc
code: /-- The type of Ring functions, to be used in the definition of the language of rings.
It contains the operations (+,*,-,0,1) -/
inductive ringFunc : ℕ → Type
  | add : ringFunc 2
  | mul : ringFunc 2
  | neg : ringFunc 1
  | zero : ringFunc 0
  | one : ringFunc 0
  deriving DecidableEq
goal: ℕ → Type

full_name: FirstOrder.ringFunc.zero
code: /-- The type of Ring functions, to be used in the definition of the language of rings.
It contains the operations (+,*,-,0,1) -/
inductive ringFunc : ℕ → Type
  | add : ringFunc 2
  | mul : ringFunc 2
  | neg : ringFunc 1
  | zero : ringFunc 0
  | one : ringFunc 0
  deriving DecidableEq
goal: FirstOrder.ringFunc 0

full_name: FirstOrder.Language.ring
code: /-- The language of rings contains the operations (+,*,-,0,1) -/
def Language.ring : Language 
goal: FirstOrder.Language

full_name: FirstOrder.Ring.instDecidableEqFunctionsRing
code: instance (n : ℕ) : DecidableEq (Language.ring.Functions n) 
goal: DecidableEq (FirstOrder.Language.ring.Functions n)

full_name: FirstOrder.Ring.instDecidableEqRelationsRing
code: instance (n : ℕ) : DecidableEq (Language.ring.Relations n) 
goal: DecidableEq (FirstOrder.Language.ring.Relations n)

full_name: FirstOrder.Ring.addFunc
code: /-- `RingFunc.add`, but with the defeq type `Language.ring.Functions 2` instead
of `RingFunc 2` -/
abbrev addFunc : Language.ring.Functions 2 
goal: FirstOrder.Language.ring.Functions 2

full_name: FirstOrder.Ring.mulFunc
code: /-- `RingFunc.mul`, but with the defeq type `Language.ring.Functions 2` instead
of `RingFunc 2` -/
abbrev mulFunc : Language.ring.Functions 2 
goal: FirstOrder.Language.ring.Functions 2

full_name: FirstOrder.Ring.negFunc
code: /-- `RingFunc.neg`, but with the defeq type `Language.ring.Functions 1` instead
of `RingFunc 1` -/
abbrev negFunc : Language.ring.Functions 1 
goal: FirstOrder.Language.ring.Functions 1

full_name: FirstOrder.Ring.zeroFunc
code: /-- `RingFunc.zero`, but with the defeq type `Language.ring.Functions 0` instead
of `RingFunc 0` -/
abbrev zeroFunc : Language.ring.Functions 0 
goal: FirstOrder.Language.ring.Functions 0

full_name: FirstOrder.Ring.oneFunc
code: /-- `RingFunc.one`, but with the defeq type `Language.ring.Functions 0` instead
of `RingFunc 0` -/
abbrev oneFunc : Language.ring.Functions 0 
goal: FirstOrder.Language.ring.Functions 0

full_name: FirstOrder.Ring.instZeroTermRing
code: instance (α : Type*) : Zero (Language.ring.Term α) 
goal: Zero (FirstOrder.Language.ring.Term α)

full_name: FirstOrder.Ring.zero_def
code: theorem zero_def (α : Type*) : (0 : Language.ring.Term α) = Constants.term zeroFunc 
goal: 0 = FirstOrder.Language.Constants.term FirstOrder.Ring.zeroFunc

full_name: FirstOrder.Ring.instOneTermRing
code: instance (α : Type*) : One (Language.ring.Term α) 
goal: One (FirstOrder.Language.ring.Term α)

full_name: FirstOrder.Ring.one_def
code: theorem one_def (α : Type*) : (1 : Language.ring.Term α) = Constants.term oneFunc 
goal: 1 = FirstOrder.Language.Constants.term FirstOrder.Ring.oneFunc

full_name: FirstOrder.Ring.instAddTermRing
code: instance (α : Type*) : Add (Language.ring.Term α) 
goal: Add (FirstOrder.Language.ring.Term α)

full_name: FirstOrder.Ring.add_def
code: theorem add_def (α : Type*) (t₁ t₂ : Language.ring.Term α) :
    t₁ + t₂ = addFunc.apply₂ t₁ t₂ 
goal: t₁ + t₂ = FirstOrder.Ring.addFunc.apply₂ t₁ t₂

full_name: FirstOrder.Ring.instMulTermRing
code: instance (α : Type*) : Mul (Language.ring.Term α) 
goal: Mul (FirstOrder.Language.ring.Term α)

full_name: FirstOrder.Ring.mul_def
code: theorem mul_def (α : Type*) (t₁ t₂ : Language.ring.Term α) :
    t₁ * t₂ = mulFunc.apply₂ t₁ t₂ 
goal: t₁ * t₂ = FirstOrder.Ring.mulFunc.apply₂ t₁ t₂

full_name: FirstOrder.Ring.instNegTermRing
code: instance (α : Type*) : Neg (Language.ring.Term α) 
goal: Neg (FirstOrder.Language.ring.Term α)

full_name: FirstOrder.Ring.neg_def
code: theorem neg_def (α : Type*) (t : Language.ring.Term α) :
    -t = negFunc.apply₁ t 
goal: -t = FirstOrder.Ring.negFunc.apply₁ t

full_name: FirstOrder.Ring.instFintypeSymbolsRing
code: instance : Fintype Language.ring.Symbols 
goal: Fintype FirstOrder.Language.ring.Symbols

full_name: FirstOrder.Ring.card_ring
code: @[simp]
theorem card_ring : card Language.ring = 5 
goal: FirstOrder.Language.ring.card = 5

full_name: FirstOrder.Ring.CompatibleRing.funMap_neg
code: /-- A Type `R` is a `CompatibleRing` if it is a structure for the language of rings and this
structure is the same as the structure already given on `R` by the classes `Add`, `Mul` etc.

It is recommended to use this type class as a hypothesis to any theorem whose statement
requires a type to have be both a `Ring` (or `Field` etc.) and a
`Language.ring.Structure`  -/
/- This class does not extend `Add` etc, because this way it can be used in
combination with a `Ring`, or `Field` instance without having multiple different
`Add` structures on the Type. -/
class CompatibleRing (R : Type*) [Add R] [Mul R] [Neg R] [One R] [Zero R]
    extends Language.ring.Structure R where
  /-- Addition in the `Language.ring.Structure` is the same as the addition given by the
    `Add` instance -/
  funMap_add : ∀ x, funMap addFunc x = x 0 + x 1
  /-- Multiplication in the `Language.ring.Structure` is the same as the multiplication given by the
    `Mul` instance -/
  funMap_mul : ∀ x, funMap mulFunc x = x 0 * x 1
  /-- Negation in the `Language.ring.Structure` is the same as the negation given by the
    `Neg` instance -/
  funMap_neg : ∀ x, funMap negFunc x = -x 0
  /-- The constant `0` in the `Language.ring.Structure` is the same as the constant given by the
    `Zero` instance -/
  funMap_zero : ∀ x, funMap (zeroFunc : Language.ring.Constants) x = 0
  /-- The constant `1` in the `Language.ring.Structure` is the same as the constant given by the
    `One` instance -/
  funMap_one : ∀ x, funMap (oneFunc : Language.ring.Constants) x = 1
goal: FirstOrder.Language.Structure.funMap FirstOrder.Ring.negFunc x = -x 0

full_name: FirstOrder.Ring.CompatibleRing
code: /-- A Type `R` is a `CompatibleRing` if it is a structure for the language of rings and this
structure is the same as the structure already given on `R` by the classes `Add`, `Mul` etc.

It is recommended to use this type class as a hypothesis to any theorem whose statement
requires a type to have be both a `Ring` (or `Field` etc.) and a
`Language.ring.Structure`  -/
/- This class does not extend `Add` etc, because this way it can be used in
combination with a `Ring`, or `Field` instance without having multiple different
`Add` structures on the Type. -/
class CompatibleRing (R : Type*) [Add R] [Mul R] [Neg R] [One R] [Zero R]
    extends Language.ring.Structure R where
  /-- Addition in the `Language.ring.Structure` is the same as the addition given by the
    `Add` instance -/
  funMap_add : ∀ x, funMap addFunc x = x 0 + x 1
  /-- Multiplication in the `Language.ring.Structure` is the same as the multiplication given by the
    `Mul` instance -/
  funMap_mul : ∀ x, funMap mulFunc x = x 0 * x 1
  /-- Negation in the `Language.ring.Structure` is the same as the negation given by the
    `Neg` instance -/
  funMap_neg : ∀ x, funMap negFunc x = -x 0
  /-- The constant `0` in the `Language.ring.Structure` is the same as the constant given by the
    `Zero` instance -/
  funMap_zero : ∀ x, funMap (zeroFunc : Language.ring.Constants) x = 0
  /-- The constant `1` in the `Language.ring.Structure` is the same as the constant given by the
    `One` instance -/
  funMap_one : ∀ x, funMap (oneFunc : Language.ring.Constants) x = 1
goal: Type u_2

full_name: FirstOrder.Ring.CompatibleRing.funMap_zero
code: /-- A Type `R` is a `CompatibleRing` if it is a structure for the language of rings and this
structure is the same as the structure already given on `R` by the classes `Add`, `Mul` etc.

It is recommended to use this type class as a hypothesis to any theorem whose statement
requires a type to have be both a `Ring` (or `Field` etc.) and a
`Language.ring.Structure`  -/
/- This class does not extend `Add` etc, because this way it can be used in
combination with a `Ring`, or `Field` instance without having multiple different
`Add` structures on the Type. -/
class CompatibleRing (R : Type*) [Add R] [Mul R] [Neg R] [One R] [Zero R]
    extends Language.ring.Structure R where
  /-- Addition in the `Language.ring.Structure` is the same as the addition given by the
    `Add` instance -/
  funMap_add : ∀ x, funMap addFunc x = x 0 + x 1
  /-- Multiplication in the `Language.ring.Structure` is the same as the multiplication given by the
    `Mul` instance -/
  funMap_mul : ∀ x, funMap mulFunc x = x 0 * x 1
  /-- Negation in the `Language.ring.Structure` is the same as the negation given by the
    `Neg` instance -/
  funMap_neg : ∀ x, funMap negFunc x = -x 0
  /-- The constant `0` in the `Language.ring.Structure` is the same as the constant given by the
    `Zero` instance -/
  funMap_zero : ∀ x, funMap (zeroFunc : Language.ring.Constants) x = 0
  /-- The constant `1` in the `Language.ring.Structure` is the same as the constant given by the
    `One` instance -/
  funMap_one : ∀ x, funMap (oneFunc : Language.ring.Constants) x = 1
goal: FirstOrder.Language.Structure.funMap FirstOrder.Ring.zeroFunc x = 0

full_name: FirstOrder.Ring.CompatibleRing.funMap_one
code: /-- A Type `R` is a `CompatibleRing` if it is a structure for the language of rings and this
structure is the same as the structure already given on `R` by the classes `Add`, `Mul` etc.

It is recommended to use this type class as a hypothesis to any theorem whose statement
requires a type to have be both a `Ring` (or `Field` etc.) and a
`Language.ring.Structure`  -/
/- This class does not extend `Add` etc, because this way it can be used in
combination with a `Ring`, or `Field` instance without having multiple different
`Add` structures on the Type. -/
class CompatibleRing (R : Type*) [Add R] [Mul R] [Neg R] [One R] [Zero R]
    extends Language.ring.Structure R where
  /-- Addition in the `Language.ring.Structure` is the same as the addition given by the
    `Add` instance -/
  funMap_add : ∀ x, funMap addFunc x = x 0 + x 1
  /-- Multiplication in the `Language.ring.Structure` is the same as the multiplication given by the
    `Mul` instance -/
  funMap_mul : ∀ x, funMap mulFunc x = x 0 * x 1
  /-- Negation in the `Language.ring.Structure` is the same as the negation given by the
    `Neg` instance -/
  funMap_neg : ∀ x, funMap negFunc x = -x 0
  /-- The constant `0` in the `Language.ring.Structure` is the same as the constant given by the
    `Zero` instance -/
  funMap_zero : ∀ x, funMap (zeroFunc : Language.ring.Constants) x = 0
  /-- The constant `1` in the `Language.ring.Structure` is the same as the constant given by the
    `One` instance -/
  funMap_one : ∀ x, funMap (oneFunc : Language.ring.Constants) x = 1
goal: FirstOrder.Language.Structure.funMap FirstOrder.Ring.oneFunc x = 1

full_name: FirstOrder.Ring.CompatibleRing.funMap_mul
code: /-- A Type `R` is a `CompatibleRing` if it is a structure for the language of rings and this
structure is the same as the structure already given on `R` by the classes `Add`, `Mul` etc.

It is recommended to use this type class as a hypothesis to any theorem whose statement
requires a type to have be both a `Ring` (or `Field` etc.) and a
`Language.ring.Structure`  -/
/- This class does not extend `Add` etc, because this way it can be used in
combination with a `Ring`, or `Field` instance without having multiple different
`Add` structures on the Type. -/
class CompatibleRing (R : Type*) [Add R] [Mul R] [Neg R] [One R] [Zero R]
    extends Language.ring.Structure R where
  /-- Addition in the `Language.ring.Structure` is the same as the addition given by the
    `Add` instance -/
  funMap_add : ∀ x, funMap addFunc x = x 0 + x 1
  /-- Multiplication in the `Language.ring.Structure` is the same as the multiplication given by the
    `Mul` instance -/
  funMap_mul : ∀ x, funMap mulFunc x = x 0 * x 1
  /-- Negation in the `Language.ring.Structure` is the same as the negation given by the
    `Neg` instance -/
  funMap_neg : ∀ x, funMap negFunc x = -x 0
  /-- The constant `0` in the `Language.ring.Structure` is the same as the constant given by the
    `Zero` instance -/
  funMap_zero : ∀ x, funMap (zeroFunc : Language.ring.Constants) x = 0
  /-- The constant `1` in the `Language.ring.Structure` is the same as the constant given by the
    `One` instance -/
  funMap_one : ∀ x, funMap (oneFunc : Language.ring.Constants) x = 1
goal: FirstOrder.Language.Structure.funMap FirstOrder.Ring.mulFunc x = x 0 * x 1

full_name: FirstOrder.Ring.CompatibleRing.funMap_add
code: /-- A Type `R` is a `CompatibleRing` if it is a structure for the language of rings and this
structure is the same as the structure already given on `R` by the classes `Add`, `Mul` etc.

It is recommended to use this type class as a hypothesis to any theorem whose statement
requires a type to have be both a `Ring` (or `Field` etc.) and a
`Language.ring.Structure`  -/
/- This class does not extend `Add` etc, because this way it can be used in
combination with a `Ring`, or `Field` instance without having multiple different
`Add` structures on the Type. -/
class CompatibleRing (R : Type*) [Add R] [Mul R] [Neg R] [One R] [Zero R]
    extends Language.ring.Structure R where
  /-- Addition in the `Language.ring.Structure` is the same as the addition given by the
    `Add` instance -/
  funMap_add : ∀ x, funMap addFunc x = x 0 + x 1
  /-- Multiplication in the `Language.ring.Structure` is the same as the multiplication given by the
    `Mul` instance -/
  funMap_mul : ∀ x, funMap mulFunc x = x 0 * x 1
  /-- Negation in the `Language.ring.Structure` is the same as the negation given by the
    `Neg` instance -/
  funMap_neg : ∀ x, funMap negFunc x = -x 0
  /-- The constant `0` in the `Language.ring.Structure` is the same as the constant given by the
    `Zero` instance -/
  funMap_zero : ∀ x, funMap (zeroFunc : Language.ring.Constants) x = 0
  /-- The constant `1` in the `Language.ring.Structure` is the same as the constant given by the
    `One` instance -/
  funMap_one : ∀ x, funMap (oneFunc : Language.ring.Constants) x = 1
goal: FirstOrder.Language.Structure.funMap FirstOrder.Ring.addFunc x = x 0 + x 1

full_name: FirstOrder.Ring.realize_add
code: @[simp]
theorem realize_add (x y : ring.Term α) (v : α → R) :
    Term.realize v (x + y) = Term.realize v x + Term.realize v y 
goal: FirstOrder.Language.Term.realize v (x + y) = FirstOrder.Language.Term.realize v x + FirstOrder.Language.Term.realize v y

full_name: FirstOrder.Ring.realize_mul
code: @[simp]
theorem realize_mul (x y : ring.Term α) (v : α → R) :
    Term.realize v (x * y) = Term.realize v x * Term.realize v y 
goal: FirstOrder.Language.Term.realize v (x * y) = FirstOrder.Language.Term.realize v x * FirstOrder.Language.Term.realize v y

full_name: FirstOrder.Ring.realize_neg
code: @[simp]
theorem realize_neg (x : ring.Term α) (v : α → R) :
    Term.realize v (-x) = -Term.realize v x 
goal: FirstOrder.Language.Term.realize v (-x) = -FirstOrder.Language.Term.realize v x

full_name: FirstOrder.Ring.realize_zero
code: @[simp]
theorem realize_zero (v : α → R) : Term.realize v (0 : ring.Term α) = 0 
goal: FirstOrder.Language.Term.realize v 0 = 0

full_name: FirstOrder.Ring.realize_one
code: @[simp]
theorem realize_one (v : α → R) : Term.realize v (1 : ring.Term α) = 1 
goal: FirstOrder.Language.Term.realize v 1 = 1

full_name: FirstOrder.Ring.compatibleRingOfRing
code: /-- Given a Type `R` with instances for each of the `Ring` operations, make a
`Language.ring.Structure R` instance, along with a proof that the operations given
by the `Language.ring.Structure` are the same as those given by the `Add` or `Mul` etc.
instances.

This definition can be used when applying a theorem about the model theory of rings
to a literal ring `R`, by writing `let _ := compatibleRingOfRing R`. After this, if,
for example, `R` is a field, then Lean will be able to find the instance for
`Theory.field.Model R`, and it will be possible to apply theorems about the model theory
of fields.

This is a `def` and not an `instance`, because the path
`Ring` => `Language.ring.Structure` => `Ring` cannot be made to
commute by definition
-/
def compatibleRingOfRing (R : Type*) [Add R] [Mul R] [Neg R] [One R] [Zero R] :
    CompatibleRing R 
goal: FirstOrder.Ring.CompatibleRing R

full_name: FirstOrder.Ring.languageEquivEquivRingEquiv
code: /-- An isomorphism in the language of rings is a ring isomorphism -/
def languageEquivEquivRingEquiv {R S : Type*}
    [NonAssocRing R] [NonAssocRing S]
    [CompatibleRing R] [CompatibleRing S] :
    (Language.ring.Equiv R S) ≃ (R ≃+* S) 
goal: FirstOrder.Language.ring.Equiv R S ≃ (R ≃+* S)

full_name: FirstOrder.Ring.addOfRingStructure
code: /-- A def to put an `Add` instance on a type with a `Language.ring.Structure` instance.

To be used sparingly, usually only when defining a more useful definition like,
`[Language.ring.Structure K] -> [Theory.field.Model K] -> Field K` -/
abbrev addOfRingStructure : Add R 
goal: Add R

full_name: FirstOrder.Ring.mulOfRingStructure
code: /-- A def to put an `Mul` instance on a type with a `Language.ring.Structure` instance.

To be used sparingly, usually only when defining a more useful definition like,
`[Language.ring.Structure K] -> [Theory.field.Model K] -> Field K` -/
abbrev mulOfRingStructure : Mul R 
goal: Mul R

full_name: FirstOrder.Ring.negOfRingStructure
code: /-- A def to put an `Neg` instance on a type with a `Language.ring.Structure` instance.

To be used sparingly, usually only when defining a more useful definition like,
`[Language.ring.Structure K] -> [Theory.field.Model K] -> Field K` -/
abbrev negOfRingStructure : Neg R 
goal: Neg R

full_name: FirstOrder.Ring.zeroOfRingStructure
code: /-- A def to put an `Zero` instance on a type with a `Language.ring.Structure` instance.

To be used sparingly, usually only when defining a more useful definition like,
`[Language.ring.Structure K] -> [Theory.field.Model K] -> Field K` -/
abbrev zeroOfRingStructure : Zero R 
goal: Zero R

full_name: FirstOrder.Ring.oneOfRingStructure
code: /-- A def to put an `One` instance on a type with a `Language.ring.Structure` instance.

To be used sparingly, usually only when defining a more useful definition like,
`[Language.ring.Structure K] -> [Theory.field.Model K] -> Field K` -/
abbrev oneOfRingStructure : One R 
goal: One R

full_name: FirstOrder.Ring.compatibleRingOfRingStructure
code: /--
Given a Type `R` with a `Language.ring.Structure R`, the instance given by
`addOfRingStructure` etc are compatible with the `Language.ring.Structure` instance on `R`.

This definition is only to be used when `addOfRingStructure`, `mulOfRingStructure` etc
are local instances.
-/
abbrev compatibleRingOfRingStructure : CompatibleRing R 
goal: FirstOrder.Ring.CompatibleRing R