Skip to content

Commit 4c27183

Browse files
authored
refactor(FirstOrder): ClosedSemiterm, Closedterm (#519)
1 parent 0aa55cc commit 4c27183

File tree

12 files changed

+186
-137
lines changed

12 files changed

+186
-137
lines changed

Foundation/FirstOrder/Arithmetic/Basic/ORingStruc.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ end
149149

150150
open Semiterm Semiformula
151151

152-
abbrev Polynomial (n : ℕ) : Type := Semiterm ℒₒᵣ Empty n
152+
abbrev Polynomial (n : ℕ) : Type := ClosedSemiterm ℒₒᵣ n
153153

154154
class Structure.ORing (L : Language) [L.ORing] (M : Type w) [ORingStruc M] [Structure L M] extends
155155
Structure.Zero L M, Structure.One L M, Structure.Add L M, Structure.Mul L M, Structure.Eq L M, Structure.LT L M

Foundation/FirstOrder/Basic/Coding.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ lemma encode_eq_toNat (t : Semiterm L ξ n) : encode t = toNat t := rfl
6161
lemma toNat_func {k} (f : L.Func k) (v : Fin k → Semiterm L ξ n) :
6262
toNat (func f v) = (Nat.pair 2 <| Nat.pair k <| Nat.pair (encode f) <| Matrix.vecToNat fun i ↦ toNat (v i)) + 1 := rfl
6363

64-
@[simp] lemma encode_emb (t : Semiterm L Empty n) : encode (Rew.emb t : Semiterm L ξ n) = encode t := by
64+
@[simp] lemma encode_emb (t : ClosedSemiterm L n) : encode (Rew.emb t : Semiterm L ξ n) = encode t := by
6565
simp only [encode_eq_toNat]
6666
induction t
6767
· simp [toNat]

Foundation/FirstOrder/Basic/Operator.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ variable {L : Language}
1010
namespace Semiterm
1111

1212
structure Operator (L : Language) (n : ℕ) where
13-
term : Semiterm L Empty n
13+
term : ClosedSemiterm L n
1414

1515
abbrev Const (L : Language.{u}) := Operator L 0
1616

1717
def fn {k} (f : L.Func k) : Operator L k := ⟨Semiterm.func f (#·)⟩
1818

1919
namespace Operator
2020

21-
def equiv : Operator L n ≃ Semiterm L Empty n where
21+
def equiv : Operator L n ≃ ClosedSemiterm L n where
2222
toFun := Operator.term
2323
invFun := Operator.mk
2424
left_inv := by intro _; simp

Foundation/FirstOrder/Basic/Semantics/Semantics.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ def val (s : Structure L M) (e : Fin n → M) (ε : ξ → M) : Semiterm L ξ n
7575
| &x => ε x
7676
| func f v => s.func f (fun i => (v i).val s e ε)
7777

78-
abbrev valb (s : Structure L M) (e : Fin n → M) (t : Semiterm L Empty n) : M := t.val s e Empty.elim
78+
abbrev valb (s : Structure L M) (e : Fin n → M) (t : ClosedSemiterm L n) : M := t.val s e Empty.elim
7979

8080
abbrev valm (M : Type w) [s : Structure L M] {n} (e : Fin n → M) (ε : ξ → M) : Semiterm L ξ n → M := val s e ε
8181

82-
abbrev valbm (M : Type w) [s : Structure L M] {n} (e : Fin n → M) : Semiterm L Empty n → M := valb s e
82+
abbrev valbm (M : Type w) [s : Structure L M] {n} (e : Fin n → M) : ClosedSemiterm L n → M := valb s e
8383

8484
abbrev realize (s : Structure L M) (t : Term L M) : M := t.val s ![] id
8585

@@ -141,7 +141,7 @@ lemma val_embSubsts (w : Fin k → Semiterm L ξ n) (t : Semiterm L Empty k) :
141141
valb s e (Rew.toS t) = val s ![] e t := by
142142
simp [val_rew, Matrix.empty_eq]; congr
143143

144-
@[simp] lemma val_toF {e : Fin n → M} (t : Semiterm L Empty n) :
144+
@[simp] lemma val_toF {e : Fin n → M} (t : ClosedSemiterm L n) :
145145
val s ![] e (Rew.toF t) = valb s e t := by
146146
simp only [val_rew]; congr; funext i; contradiction
147147

@@ -151,7 +151,7 @@ variable (φ : L₁ →ᵥ L₂) (e : Fin n → M) (ε : ξ → M)
151151

152152
lemma val_lMap (φ : L₁ →ᵥ L₂) (s₂ : Structure L₂ M) (e : Fin n → M) (ε : ξ → M) {t : Semiterm L₁ ξ n} :
153153
(t.lMap φ).val s₂ e ε = t.val (s₂.lMap φ) e ε :=
154-
by induction t <;> simp [*, valm, Function.comp_def, val_func, Semiterm.lMap_func]
154+
by induction t <;> simp [*, val_func, Semiterm.lMap_func]
155155

156156
end Language
157157

@@ -231,7 +231,7 @@ def EvalAux (s : Structure L M) (ε : ξ → M) : ∀ {n}, (Fin n → M) → Sem
231231

232232
@[simp] lemma EvalAux_neg (φ : Semiformula L ξ n) :
233233
EvalAux s ε e (∼φ) = ¬EvalAux s ε e φ :=
234-
by induction φ using rec' <;> simp [*, EvalAux, ←neg_eq, or_iff_not_imp_left]
234+
by induction φ using rec' <;> simp [*, EvalAux, or_iff_not_imp_left]
235235

236236
def Eval (s : Structure L M) (e : Fin n → M) (ε : ξ → M) : Semiformula L ξ n →ˡᶜ Prop where
237237
toTr := EvalAux s ε e
@@ -240,7 +240,7 @@ def Eval (s : Structure L M) (e : Fin n → M) (ε : ξ → M) : Semiformula L
240240
map_and' := by simp [EvalAux]
241241
map_or' := by simp [EvalAux]
242242
map_neg' := by simp [EvalAux_neg]
243-
map_imply' := by simp [imp_eq, EvalAux_neg, ←neg_eq, EvalAux, imp_iff_not_or]
243+
map_imply' := by simp [EvalAux_neg, ←neg_eq, EvalAux, imp_iff_not_or]
244244

245245
abbrev Evalm (M : Type w) [s : Structure L M] {n} (e : Fin n → M) (ε : ξ → M) :
246246
Semiformula L ξ n →ˡᶜ Prop := Eval s e ε
@@ -647,7 +647,7 @@ noncomputable instance nonemptyModelOfSat (h : Semantics.Satisfiable (Struc.{v,
647647
choose i _ _ using Classical.choose_spec (satisfiable_iff.mp h); exact i
648648

649649
noncomputable def StructureModelOfSatAux (h : Semantics.Satisfiable (Struc.{v, u} L) T) :
650-
{ s : Structure L (ModelOfSat h) // ModelOfSat h ⊧ₘ* T } := by
650+
{ _s : Structure L (ModelOfSat h) // ModelOfSat h ⊧ₘ* T } := by
651651
choose _ s h using Classical.choose_spec (satisfiable_iff.mp h)
652652
exact ⟨s, h⟩
653653

@@ -729,7 +729,7 @@ variable {M : Type u} [Nonempty M] [s₂ : Structure L₂ M]
729729

730730
lemma modelsTheory_onTheory₁ {T₁ : Theory L₁} :
731731
ModelsTheory (s := s₂) M (T₁.lMap Φ) ↔ ModelsTheory (s := s₂.lMap Φ) M T₁ :=
732-
by simp [Semiformula.models_lMap, Theory.lMap, modelsTheory_iff, @modelsTheory_iff (T := T₁)]
732+
by simp [Semiformula.models_lMap, Theory.lMap, @modelsTheory_iff (T := T₁)]
733733

734734
end Theory
735735

Foundation/FirstOrder/Basic/Syntax/Rew.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ lemma coe_rel [IsEmpty ο] {k : ℕ} (R : L.Rel k) (v : Fin k → Semiterm L ο
236236
lemma coe_nrel [IsEmpty ο] {k : ℕ} (R : L.Rel k) (v : Fin k → Semiterm L ο n) :
237237
(Rewriting.embedding (nrel R v) : Semiformula L ξ n) = (nrel R fun i ↦ Rew.emb (v i)) := by rfl
238238

239-
lemma coe_substitute_eq_substitute_coe (φ : Semisentence L k) (v : Fin k → Semiterm L Empty n) :
239+
lemma coe_substitute_eq_substitute_coe (φ : Semisentence L k) (v : Fin k → ClosedSemiterm L n) :
240240
(↑(φ ⇜ v) : SyntacticSemiformula L n) = (↑φ : SyntacticSemiformula L k)⇜(fun i ↦ (↑(v i) : Semiterm L ℕ n)) :=
241241
Rewriting.embedding_substitute_eq_substitute_embedding φ v
242242

243-
lemma coe_substs_eq_substs_coe₁ (φ : Semisentence L 1) (t : Semiterm L Empty n) :
243+
lemma coe_substs_eq_substs_coe₁ (φ : Semisentence L 1) (t : ClosedSemiterm L n) :
244244
(↑(φ/[t]) : SyntacticSemiformula L n) = (↑φ : SyntacticSemiformula L 1)/[(↑t : Semiterm L ℕ n)] :=
245245
Rewriting.embedding_substs_eq_substs_coe₁ φ t
246246

Foundation/FirstOrder/Internal/DerivabilityCondition/D3.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ noncomputable abbrev toNumVec (w : Fin n → V) : SemitermVec V ℒₒᵣ n k :=
3636

3737
variable (T)
3838

39-
theorem term_complete {n : ℕ} (t : FirstOrder.Semiterm ℒₒᵣ Empty n) (w : Fin n → V) :
39+
theorem term_complete {n : ℕ} (t : FirstOrder.ClosedSemiterm ℒₒᵣ n) (w : Fin n → V) :
4040
T.internalize V ⊢! (toNumVec w ⤕ ⌜t⌝) ≐ 𝕹 (t.valbm V w) :=
4141
match t with
4242
| #z => by simp

Foundation/FirstOrder/Internal/Syntax/Formula/Coding.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,16 @@ noncomputable instance : LCWQIsoGoedelQuote (Semisentence L) (Metamath.Semiformu
249249
def empty_typed_quote_def (σ : Semisentence L n) :
250250
(⌜σ⌝ : Metamath.Semiformula V L n) = ⌜(Rewriting.embedding σ : SyntacticSemiformula L n)⌝ := rfl
251251

252-
@[simp] lemma empty_typed_quote_eq (t u : Semiterm ℒₒᵣ Empty n) :
252+
@[simp] lemma empty_typed_quote_eq (t u : ClosedSemiterm ℒₒᵣ n) :
253253
(⌜(“!!t = !!u” : Semisentence ℒₒᵣ n)⌝ : Metamath.Semiformula V ℒₒᵣ n) = (⌜t⌝ ≐ ⌜u⌝) := rfl
254254

255-
@[simp] lemma empty_typed_quote_ne (t u : Semiterm ℒₒᵣ Empty n) :
255+
@[simp] lemma empty_typed_quote_ne (t u : ClosedSemiterm ℒₒᵣ n) :
256256
(⌜(“!!t ≠ !!u” : Semisentence ℒₒᵣ n)⌝ : Metamath.Semiformula V ℒₒᵣ n) = (⌜t⌝ ≉ ⌜u⌝) := rfl
257257

258-
@[simp] lemma empty_typed_quote_lt (t u : Semiterm ℒₒᵣ Empty n) :
258+
@[simp] lemma empty_typed_quote_lt (t u : ClosedSemiterm ℒₒᵣ n) :
259259
(⌜(“!!t < !!u” : Semisentence ℒₒᵣ n)⌝ : Metamath.Semiformula V ℒₒᵣ n) = (⌜t⌝ <' ⌜u⌝) := rfl
260260

261-
@[simp] lemma empty_typed_quote_nlt (t u : Semiterm ℒₒᵣ Empty n) :
261+
@[simp] lemma empty_typed_quote_nlt (t u : ClosedSemiterm ℒₒᵣ n) :
262262
(⌜(“!!t ≮ !!u” : Semisentence ℒₒᵣ n)⌝ : Metamath.Semiformula V ℒₒᵣ n) = (⌜t⌝ ≮' ⌜u⌝) := rfl
263263

264264
noncomputable instance : GoedelQuote (Semisentence L n) V where

Foundation/FirstOrder/Internal/Syntax/Term/Coding.lean

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,43 +147,43 @@ lemma coe_quote_eq_quote' (t : SyntacticSemiterm L n) :
147147

148148
variable (V)
149149

150-
noncomputable instance : GoedelQuote (Semiterm L Empty n) (Metamath.Semiterm V L n) where
150+
noncomputable instance : GoedelQuote (ClosedSemiterm L n) (Metamath.Semiterm V L n) where
151151
quote t := ⌜(Rew.emb t : SyntacticSemiterm L n)⌝
152152

153153
variable {V}
154154

155-
def empty_typed_quote_def (t : Semiterm L Empty n) :
155+
def empty_typed_quote_def (t : ClosedSemiterm L n) :
156156
(⌜t⌝ : Metamath.Semiterm V L n) = ⌜(Rew.emb t : SyntacticSemiterm L n)⌝ := rfl
157157

158158
@[simp] lemma empty_typed_quote_bvar (x : Fin n) :
159-
(⌜(#x : Semiterm L Empty n)⌝ : Metamath.Semiterm V L n) = Metamath.Semiterm.bvar x := rfl
159+
(⌜(#x : ClosedSemiterm L n)⌝ : Metamath.Semiterm V L n) = Metamath.Semiterm.bvar x := rfl
160160

161-
@[simp] lemma empty_typed_quote_func (f : L.Func k) (v : Fin k → Semiterm L Empty n) :
161+
@[simp] lemma empty_typed_quote_func (f : L.Func k) (v : Fin k → ClosedSemiterm L n) :
162162
(⌜func f v⌝ : Metamath.Semiterm V L n) = Metamath.Semiterm.func f fun i ↦ ⌜v i⌝ := rfl
163163

164-
@[simp] lemma empty_typed_quote_add (t u : Semiterm ℒₒᵣ Empty n) :
165-
(⌜(‘!!t + !!u’ : Semiterm ℒₒᵣ Empty n)⌝ : Metamath.Semiterm V ℒₒᵣ n) = ⌜t⌝ + ⌜u⌝ := rfl
164+
@[simp] lemma empty_typed_quote_add (t u : ClosedSemiterm ℒₒᵣ n) :
165+
(⌜(‘!!t + !!u’ : ClosedSemiterm ℒₒᵣ n)⌝ : Metamath.Semiterm V ℒₒᵣ n) = ⌜t⌝ + ⌜u⌝ := rfl
166166

167-
@[simp] lemma empty_typed_quote_mul (t u : Semiterm ℒₒᵣ Empty n) :
168-
(⌜(‘!!t * !!u’ : Semiterm ℒₒᵣ Empty n)⌝ : Metamath.Semiterm V ℒₒᵣ n) = ⌜t⌝ * ⌜u⌝ := rfl
167+
@[simp] lemma empty_typed_quote_mul (t u : ClosedSemiterm ℒₒᵣ n) :
168+
(⌜(‘!!t * !!u’ : ClosedSemiterm ℒₒᵣ n)⌝ : Metamath.Semiterm V ℒₒᵣ n) = ⌜t⌝ * ⌜u⌝ := rfl
169169

170170
@[simp] lemma empty_typed_quote_numeral_eq_numeral (k : ℕ) :
171-
(⌜(↑k : Semiterm ℒₒᵣ Empty n)⌝ : Metamath.Semiterm V ℒₒᵣ n) = typedNumeral ↑k := by
171+
(⌜(↑k : ClosedSemiterm ℒₒᵣ n)⌝ : Metamath.Semiterm V ℒₒᵣ n) = typedNumeral ↑k := by
172172
simp [empty_typed_quote_def]
173173

174-
noncomputable instance : GoedelQuote (Semiterm L Empty n) V where
174+
noncomputable instance : GoedelQuote (ClosedSemiterm L n) V where
175175
quote t := ⌜(Rew.emb t : SyntacticSemiterm L n)⌝
176176

177-
lemma empty_quote_def (t : Semiterm L Empty n) : (⌜t⌝ : V) = ⌜(Rew.emb t : SyntacticSemiterm L n)⌝ := rfl
177+
lemma empty_quote_def (t : ClosedSemiterm L n) : (⌜t⌝ : V) = ⌜(Rew.emb t : SyntacticSemiterm L n)⌝ := rfl
178178

179-
def empty_quote_eq (t : Semiterm L Empty n) : (⌜t⌝ : V) = (⌜t⌝ : Metamath.Semiterm V L n).val := rfl
179+
def empty_quote_eq (t : ClosedSemiterm L n) : (⌜t⌝ : V) = (⌜t⌝ : Metamath.Semiterm V L n).val := rfl
180180

181-
lemma empty_quote_eq_encode (t : Semiterm L Empty n) : (⌜t⌝ : V) = ↑(encode t) := by simp [empty_quote_def, quote_eq_encode]
181+
lemma empty_quote_eq_encode (t : ClosedSemiterm L n) : (⌜t⌝ : V) = ↑(encode t) := by simp [empty_quote_def, quote_eq_encode]
182182

183183
@[simp] lemma coe_quote {ξ n} (t : SyntacticSemiterm L n) : ↑(⌜t⌝ : ℕ) = (⌜t⌝ : Semiterm ℒₒᵣ ξ m) := by
184184
simp [goedelNumber'_def, quote_eq_encode]
185185

186-
@[simp] lemma coe_empty_quote {ξ n} (t : Semiterm L Empty n) : ↑(⌜t⌝ : ℕ) = (⌜t⌝ : Semiterm ℒₒᵣ ξ m) := by
186+
@[simp] lemma coe_empty_quote {ξ n} (t : ClosedSemiterm L n) : ↑(⌜t⌝ : ℕ) = (⌜t⌝ : Semiterm ℒₒᵣ ξ m) := by
187187
simp [goedelNumber'_def, empty_quote_eq_encode]
188188

189189
end LO.FirstOrder.Semiterm

Foundation/Logic/LogicSymbol.lean

Lines changed: 28 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ variable {α β γ}
145145

146146
instance : FunLike (α →ˡᶜ β) α β where
147147
coe := toTr
148-
coe_injective' := by intro f g h; rcases f; rcases g; simp; exact h
148+
coe_injective' := by
149+
intro f g h; rcases f; rcases g; simpa using h
149150

150151
instance : CoeFun (α →ˡᶜ β) (fun _ => α → β) := DFunLike.hasCoeToFun
151152

@@ -244,15 +245,16 @@ def conjLt (φ : ℕ → α) : ℕ → α
244245

245246
@[simp] lemma hom_conj_prop [FunLike F α Prop] [LogicalConnective.HomClass F α Prop] (f : F) (φ : ℕ → α) :
246247
f (conjLt φ k) ↔ ∀ i < k, f (φ i) := by
247-
induction' k with k ih <;> simp [*]
248-
constructor
249-
· rintro ⟨hk, h⟩
250-
intro i hi
251-
rcases Nat.eq_or_lt_of_le (Nat.le_of_lt_succ hi) with (rfl | hi)
252-
· exact hk
253-
· exact h i hi
254-
· rintro h
255-
exact ⟨h k (by simp), fun i hi ↦ h i (Nat.lt_add_right 1 hi)⟩
248+
induction' k with k ih
249+
· simp [*]
250+
· suffices (f (φ k) ∧ ∀ i < k, f (φ i)) ↔ ∀ i < k + 1, f (φ i) by simp [*]
251+
constructor
252+
· rintro ⟨hk, h⟩
253+
intro i hi
254+
rcases Nat.eq_or_lt_of_le (Nat.le_of_lt_succ hi) with (rfl | hi)
255+
· exact hk
256+
· exact h i hi
257+
· grind
256258

257259
def disjLt (φ : ℕ → α) : ℕ → α
258260
| 0 => ⊥
@@ -264,15 +266,10 @@ def disjLt (φ : ℕ → α) : ℕ → α
264266

265267
@[simp] lemma hom_disj_prop [FunLike F α Prop] [LogicalConnective.HomClass F α Prop] (f : F) (φ : ℕ → α) :
266268
f (disjLt φ k) ↔ ∃ i < k, f (φ i) := by
267-
induction' k with k ih <;> simp [*]
268-
constructor
269-
· rintro (h | ⟨i, hi, h⟩)
270-
· exact ⟨k, by simp, h⟩
271-
· exact ⟨i, Nat.lt_add_right 1 hi, h⟩
272-
· rintro ⟨i, hi, h⟩
273-
rcases Nat.eq_or_lt_of_le (Nat.le_of_lt_succ hi) with (rfl | hi)
274-
· left; exact h
275-
· right; exact ⟨i, hi, h⟩
269+
induction' k with k ih
270+
· simp [*]
271+
· suffices (f (φ k) ∨ ∃ i < k, f (φ i)) ↔ ∃ i < k + 1, f (φ i) by simp [*]
272+
grind
276273

277274
end conjdisj
278275

@@ -316,15 +313,19 @@ variable [LogicalConnective α] [LogicalConnective β]
316313

317314
@[simp] lemma conj_hom_prop [FunLike F α Prop] [LogicalConnective.HomClass F α Prop]
318315
(f : F) (v : Fin n → α) : f (conj v) = ∀ i, f (v i) := by
319-
induction' n with n ih <;> simp [conj]
320-
· simp [ih]; constructor
316+
induction' n with n ih
317+
· simp [conj]
318+
· suffices (f (v 0) ∧ ∀ (i : Fin n), f (vecTail v i)) ↔ ∀ (i : Fin (n + 1)), f (v i) by simpa [conj, ih]
319+
constructor
321320
· intro ⟨hz, hs⟩ i; cases i using Fin.cases; { exact hz }; { exact hs _ }
322321
· intro h; exact ⟨h 0, fun i => h _⟩
323322

324323
@[simp] lemma disj_hom_prop [FunLike F α Prop] [LogicalConnective.HomClass F α Prop]
325324
(f : F) (v : Fin n → α) : f (disj v) = ∃ i, f (v i) := by
326-
induction' n with n ih <;> simp [disj]
327-
· simp [ih]; constructor
325+
induction' n with n ih
326+
· simp [disj]
327+
· suffices (f (v 0) ∨ ∃ i, f (vecTail v i)) ↔ ∃ i, f (v i) by simpa [disj, ih]
328+
constructor
328329
· rintro (H | ⟨i, H⟩); { exact ⟨0, H⟩ }; { exact ⟨i.succ, H⟩ }
329330
· rintro ⟨i, h⟩
330331
cases i using Fin.cases; { left; exact h }; { right; exact ⟨_, h⟩ }
@@ -600,16 +601,8 @@ variable [LogicalConnective α]
600601

601602
lemma map_conj_union [DecidableEq α] [FunLike F α Prop] [LogicalConnective.HomClass F α Prop]
602603
(f : F) (s₁ s₂ : Finset α) : f (s₁ ∪ s₂).conj ↔ f (s₁.conj ⋏ s₂.conj) := by
603-
simp
604-
constructor;
605-
. intro h;
606-
constructor;
607-
. intro a ha;
608-
exact h a (Or.inl ha);
609-
. intro a ha;
610-
exact h a (Or.inr ha);
611-
. intro ⟨h₁, h₂⟩ a ha;
612-
cases ha <;> simp_all;
604+
suffices (∀ (a : α), a ∈ s₁ ∨ a ∈ s₂ → f a) ↔ (∀ a ∈ s₁, f a) ∧ ∀ a ∈ s₂, f a by simpa
605+
grind
613606

614607
lemma map_conj' {β : Type*} [LogicalConnective β] [FunLike F α β] [LogicalConnective.HomClass F α β]
615608
(Φ : F) (s : Finset ι) (f : ι → α) : Φ (⩕ i ∈ s, f i) = ⩕ i ∈ s, Φ (f i) := by
@@ -630,14 +623,8 @@ lemma map_uconj [LogicalConnective β] [FunLike F α β] [LogicalConnective.HomC
630623

631624
lemma map_disj_union [DecidableEq α] [FunLike F α Prop] [LogicalConnective.HomClass F α Prop]
632625
(f : F) (s₁ s₂ : Finset α) : f (s₁ ∪ s₂).disj ↔ f (s₁.disj ⋎ s₂.disj) := by
633-
simp [map_disj_prop];
634-
constructor;
635-
. rintro ⟨a, h₁ | h₂, hb⟩;
636-
. left; use a;
637-
. right; use a;
638-
. rintro (⟨a₁, h₁⟩ | ⟨a₂, h₂⟩);
639-
. use a₁; simp_all;
640-
. use a₂; simp_all;
626+
suffices (∃ a, (a ∈ s₁ ∨ a ∈ s₂) ∧ f a) ↔ (∃ a ∈ s₁, f a) ∨ ∃ a ∈ s₂, f a by simpa [map_disj_prop]
627+
grind
641628

642629
lemma map_disj' [LogicalConnective β] [FunLike F α β] [LogicalConnective.HomClass F α β]
643630
(Φ : F) (s : Finset ι) (f : ι → α) : Φ (⩖ i ∈ s, f i) = ⩖ i ∈ s, Φ (f i) := by

Foundation/Logic/Predicate/Language.lean

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@ instance (k) : ToString (oRing.Rel k) :=
120120
| Rel.eq => "\\mathrm{Eq}"
121121
| Rel.lt => "\\mathrm{LT}"
122122

123-
instance (k) : DecidableEq (oRing.Func k) := fun a b =>
124-
by rcases a <;> rcases b <;> simp <;> try {exact instDecidableTrue} <;> try {exact instDecidableFalse}
123+
instance (k) : DecidableEq (oRing.Func k) := fun a b => by
124+
rcases a <;> rcases b <;>
125+
simp only [reduceCtorEq] <;> try {exact instDecidableTrue} <;> try {exact instDecidableFalse}
125126

126-
instance (k) : DecidableEq (oRing.Rel k) := fun a b =>
127-
by rcases a <;> rcases b <;> simp <;> try {exact instDecidableTrue} <;> try {exact instDecidableFalse}
127+
instance (k) : DecidableEq (oRing.Rel k) := fun a b => by
128+
rcases a <;> rcases b <;>
129+
simp only [reduceCtorEq] <;> try {exact instDecidableTrue} <;> try {exact instDecidableFalse}
128130

129131
instance (k) : Encodable (oRing.Func k) where
130132
encode := fun x =>

0 commit comments

Comments
 (0)