Skip to content

Commit 6259085

Browse files
feat: port Init.Data.Sigma.Lex (#5948)
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
1 parent a9728c0 commit 6259085

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

Mathlib/Init/Data/Sigma/Lex.lean

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,67 @@ Authors: Leonardo de Moura
1111
import Mathlib.Init.Data.Sigma.Basic
1212

1313
/-!
14-
# Facts about `PSigma.Lex` from Lean 3 core.
14+
# Well-foundedness of orders of well-founded relations
15+
16+
Porting note: many declarations that were here in mathlib3 have been moved to `Init.WF`
17+
in Lean 4 core. The ones below are all the exceptions.
1518
-/
1619

1720
universe u v
1821

1922
namespace PSigma
2023

24+
section
25+
26+
open WellFounded
27+
2128
variable {α : Sort u} {β : α → Sort v} {r : α → α → Prop} {s : ∀ a : α, β a → β a → Prop}
2229

23-
-- The lexicographical order of well founded relations is well-founded
30+
#align psigma.lex PSigma.Lex
31+
#align psigma.lex_accessible PSigma.lexAccessible
32+
33+
/-- The lexicographical order of well-founded relations is well-founded. -/
2434
theorem lex_wf (ha : WellFounded r) (hb : ∀ x, WellFounded (s x)) : WellFounded (Lex r s) :=
2535
WellFounded.intro fun ⟨a, b⟩ => lexAccessible (WellFounded.apply ha a) hb b
2636
#align psigma.lex_wf PSigma.lex_wf
2737

38+
#align psigma.lex_ndep PSigma.lexNdep
39+
#align psigma.lex_ndep_wf PSigma.lexNdepWf
40+
41+
end
42+
43+
section
44+
45+
open WellFounded
46+
47+
variable {α : Sort u} {β : Sort v} {r : α → α → Prop} {s : β → β → Prop}
48+
49+
#align psigma.rev_lex PSigma.RevLex
50+
#align psigma.rev_lex_accessible PSigma.revLexAccessible
51+
52+
theorem revLex_wf (ha : WellFounded r) (hb : WellFounded s) : WellFounded (RevLex r s) :=
53+
WellFounded.intro fun ⟨a, b⟩ => revLexAccessible (apply hb b) (WellFounded.apply ha) a
54+
#align psigma.rev_lex_wf PSigma.revLex_wf
55+
56+
end
57+
58+
section
59+
60+
#align psigma.skip_left PSigma.SkipLeft
61+
62+
theorem skipLeft_wf (α : Type u) {β : Type v} {s : β → β → Prop} (hb : WellFounded s) :
63+
WellFounded (SkipLeft α s) :=
64+
revLex_wf emptyWf.wf hb
65+
#align psigma.skip_left_wf PSigma.skipLeft_wf
66+
67+
#align psigma.mk_skip_left PSigma.mkSkipLeft
68+
69+
end
70+
71+
instance hasWellFounded {α : Type u} {β : α → Type v} [s₁ : WellFoundedRelation α]
72+
[s₂ : ∀ a, WellFoundedRelation (β a)] : WellFoundedRelation (PSigma β) where
73+
rel := Lex s₁.rel fun a => (s₂ a).rel
74+
wf := lex_wf s₁.wf fun a => (s₂ a).wf
75+
#align psigma.has_well_founded PSigma.hasWellFounded
76+
2877
end PSigma

0 commit comments

Comments
 (0)