Skip to content

Commit d4ca349

Browse files
committed
chore: port Init.Propext (#471)
Porting anything trivial to port which contains lemmas mentioned by mathlib3's `norm_num` or `ring`. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent a26dc82 commit d4ca349

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import Mathlib.Init.Data.Nat.Basic
5555
import Mathlib.Init.Data.Nat.Lemmas
5656
import Mathlib.Init.Function
5757
import Mathlib.Init.Logic
58+
import Mathlib.Init.Propext
5859
import Mathlib.Init.Set
5960
import Mathlib.Init.Zero
6061
import Mathlib.Lean.Exception

Mathlib/Init/Propext.lean

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/-
2+
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Leonardo de Moura
5+
-/
6+
import Mathlib.Init.Logic
7+
import Mathlib.Mathport.Rename
8+
9+
/-! Additional congruence lemmas. -/
10+
11+
-- Porting note:
12+
-- the statement of `forall_congr_eq` in Lean 3 is identical to `forall_congr` in Lean 4,
13+
-- so is omitted.
14+
-- theorem forall_congr_eq {a : Sort u} {p q : a → Prop} (h : ∀ x, p x = q x) :
15+
-- (∀ x, p x) = ∀ x, q x :=
16+
-- (forall_congr fun a => (h a))
17+
#align forall_congr_eq forall_congr
18+
19+
theorem imp_congr_eq {a b c d : Prop} (h₁ : a = c) (h₂ : b = d) : (a → b) = (c → d) :=
20+
propext (imp_congr h₁.to_iff h₂.to_iff)
21+
22+
theorem imp_congr_ctx_eq {a b c d : Prop} (h₁ : a = c) (h₂ : c → b = d) : (a → b) = (c → d) :=
23+
propext (imp_congr_ctx h₁.to_iff fun hc => (h₂ hc).to_iff)
24+
25+
theorem eq_true_intro {a : Prop} (h : a) : a = True :=
26+
propext (iff_true_intro h)
27+
28+
theorem eq_false_intro {a : Prop} (h : ¬a) : a = False :=
29+
propext (iff_false_intro h)
30+
31+
theorem Iff.to_eq {a b : Prop} (h : a ↔ b) : a = b :=
32+
propext h
33+
34+
theorem iff_eq_eq {a b : Prop} : (a ↔ b) = (a = b) :=
35+
propext (Iff.intro (fun h => Iff.to_eq h) fun h => h.to_iff)
36+
37+
-- Porting note:
38+
-- `eq_false` and `eq_true` in Lean 3 are not used in mathlib3,
39+
-- and there are already lemmas with these names in Lean 4, so they have not been ported.
40+
41+
-- theorem eq_false {a : Prop} : (a = False) = ¬a :=
42+
-- have : (a ↔ False) = ¬a := propext (iff_false a)
43+
-- Eq.subst (@iff_eq_eq a False) this
44+
45+
-- theorem eq_true {a : Prop} : (a = True) = a :=
46+
-- have : (a ↔ True) = a := propext (iff_true a)
47+
-- Eq.subst (@iff_eq_eq a True) this

0 commit comments

Comments
 (0)