/-
Copyright (c) 2023 Chris Hughes. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Chris Hughes
-/
module
public import Mathlib.ModelTheory.Algebra.Ring.Basic
public import Mathlib.RingTheory.FreeCommRing
/-!
# Making a term in the language of rings from an element of the FreeCommRing
This file defines the function `FirstOrder.Ring.termOfFreeCommRing` which constructs a
`Language.ring.Term α` from an element of `FreeCommRing α`.
The theorem `FirstOrder.Ring.realize_termOfFreeCommRing` shows that the term constructed when
realized in a ring `R` is equal to the lift of the element of `FreeCommRing α` to `R`.
-/
@[expose] public section
namespace FirstOrder
namespace Ring
open Language
variable {α : Type*}
section
attribute [local instance] compatibleRingOfRing
set_option backward.privateInPublic true in
private theorem exists_term_realize_eq_freeCommRing (p : FreeCommRing α) :
∃ t : Language.ring.Term α,
(t.realize FreeCommRing.of : FreeCommRing α) = p :=
FreeCommRing.induction_on p
⟨-1, by simp⟩
(fun a => ⟨Term.var a, by simp [Term.realize]⟩)
(fun x y ⟨t₁, ht₁⟩ ⟨t₂, ht₂⟩ =>
⟨t₁ + t₂, by simp_all⟩)
(fun x y ⟨t₁, ht₁⟩ ⟨t₂, ht₂⟩ =>
⟨t₁ * t₂, by simp_all⟩)
end
set_option backward.privateInPublic true in
set_option backward.privateInPublic.warn false in
/-- Make a `Language.ring.Term α` from an element of `FreeCommRing α` -/
noncomputable def termOfFreeCommRing (p : FreeCommRing α) : Language.ring.Term α :=
Classical.choose (exists_term_realize_eq_freeCommRing p)
variable {R : Type*} [CommRing R] [CompatibleRing R]
set_option backward.isDefEq.respectTransparency false in
@[simp]
theorem realize_termOfFreeCommRing (p : FreeCommRing α) (v : α → R) :
(termOfFreeCommRing p).realize v = FreeCommRing.lift v p := by
rw [termOfFreeCommRing]
conv_rhs => rw [← Classical.choose_spec (exists_term_realize_eq_freeCommRing p)]
induction Classical.choose (exists_term_realize_eq_freeCommRing p) with
| var _ => simp
| func f a ih =>
cases f <;>
simp [ih]
end Ring
end FirstOrder
¤ Dauer der Verarbeitung: 0.11 Sekunden
¤
*© Formatika GbR, Deutschland