Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/Mathlib/Data/Nat/Cast/     Datei vom 15.10.2026 mit Größe 1 kB image not shown  

Quelle  Prod.lean   Sprache: Lean

 

/-
Copyright (c) 2014 Mario Carneiro. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro
-/

module

public import Mathlib.Algebra.Group.Prod
public import Mathlib.Data.Nat.Cast.Defs

set_option doc.verso true
set_option doc.verso.suggestions false

/-!
# The product of two `AddMonoidWithOne`s.
-/


public section

assert_not_exists MonoidWithZero

variable {α β : Type*}

namespace Prod

variable [AddMonoidWithOne α] [AddMonoidWithOne β]

instance instAddMonoidWithOne : AddMonoidWithOne (α × β) where
  natCast := fun n => (n, n)
  natCast_zero := by ext <;> simp
  natCast_succ n := by ext <;> simp

@[simp]
theorem fst_natCast (n : ℕ) : (n : α × β).fst = n := by induction n <;> simp [*]

@[simp]
theorem fst_ofNat (n : ℕ) [n.AtLeastTwo] :
    (ofNat(n) : α × β).1 = (ofNat(n) : α) :=
  rfl

@[simp]
theorem snd_natCast (n : ℕ) : (n : α × β).snd = n := by induction n <;> simp [*]

@[simp]
theorem snd_ofNat (n : ℕ) [n.AtLeastTwo] :
    (ofNat(n) : α × β).2 = (ofNat(n) : β) :=
  rfl

end Prod

Messung
CHZG
9110010096

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland