Skip to content

Commit

Permalink
feat: missing ext lemmas (leanprover-community#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
fgdorais authored Nov 20, 2023
1 parent 03ab63f commit e403f68
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 13 additions & 1 deletion Std/Tactic/Ext.lean
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,19 @@ syntax "ext?" (colGt ppSpace rintroPat)* (" : " num)? : tactic

end Std.Tactic.Ext

attribute [ext] funext propext
attribute [ext] funext propext Subtype.eq

@[ext] theorem Prod.ext : {x y : Prod α β} → x.fst = y.fst → x.snd = y.snd → x = y
| ⟨_,_⟩, ⟨_,_⟩, rfl, rfl => rfl

@[ext] theorem PProd.ext : {x y : PProd α β} → x.fst = y.fst → x.snd = y.snd → x = y
| ⟨_,_⟩, ⟨_,_⟩, rfl, rfl => rfl

@[ext] theorem Sigma.ext : {x y : Sigma β} → x.fst = y.fst → HEq x.snd y.snd → x = y
| ⟨_,_⟩, ⟨_,_⟩, rfl, .rfl => rfl

@[ext] theorem PSigma.ext : {x y : PSigma β} → x.fst = y.fst → HEq x.snd y.snd → x = y
| ⟨_,_⟩, ⟨_,_⟩, rfl, .rfl => rfl

@[ext] protected theorem PUnit.ext (x y : PUnit) : x = y := rfl
protected theorem Unit.ext (x y : Unit) : x = y := rfl
1 change: 0 additions & 1 deletion test/ext.lean
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ structure MyUnit
example (x y : MyUnit) : x = y := by ext; rfl

-- Check that we don't generate a warning when `x` only uses a pattern in one branch:
attribute [ext] Prod
example (f : ℕ × (ℕ → ℕ)) : f = f := by
ext x
· rfl
Expand Down

0 comments on commit e403f68

Please sign in to comment.