@@ -15,7 +15,7 @@ Traditionally the underlying set is assumed to be the half open interval $$(0,1]
1515-/
1616
1717section Fractional
18- class Fractional (α : Type _) extends Add α, One α where
18+ class Fractional (α : Type _) extends Add α where
1919 /-- Validity predicate on fractions. Generalizes the notion of `(· ≤ 1)` from rational fractions. -/
2020 proper : α → Prop
2121 add_comm : ∀ {a b : α}, a + b = b + a
@@ -98,8 +98,11 @@ instance [Fractional α] {a : Frac α} : CMRA.IdFree a where
9898
9999end Iris
100100
101- section NumericFractional
101+ /-- A type of fractions with a unique whole element. -/
102+ class UFractional (α : Type _) extends Fractional α, One α where
103+ whole_iff_one {a : α} : whole a ↔ a = 1
102104
105+ section NumericFractional
103106
104107section NumericFractional
105108/-- Generic fractional instance for types with comparison and 1 operators. -/
@@ -173,13 +176,34 @@ theorem strictly_positive {a : α} : ¬ ∃ b : α, a + b < a := by
173176 rw [←add_assoc] at H
174177 exact positive ⟨c + c1, H⟩
175178
176- instance : Fractional α where
179+ instance : UFractional α where
177180 proper x := x ≤ 1
178181 add_comm := add_comm
179182 add_assoc := add_assoc
180183 add_left_cancel := add_left_cancel
181184 add_ne H := positive (α := α) ⟨_, add_comm.trans H.symm⟩
182185 proper_add_mono_left := add_le_mono
186+ whole_iff_one {a} := by
187+ constructor
188+ · intro H
189+ simp [whole] at H
190+ rcases H with ⟨Hp, Hdp⟩
191+ cases (le_def.mp Hp)
192+ · trivial
193+ · rename_i HK; exfalso
194+ rcases (lt_def.mp HK) with ⟨c, Hc⟩
195+ apply Hdp c
196+ rw [Hc]
197+ exact le_refl
198+ · intro H; subst H
199+ refine ⟨le_refl, ?_⟩
200+ rintro ⟨b, H⟩
201+ simp [Fractional.proper] at H
202+ cases (le_def.mp H)
203+ · rename_i H''
204+ apply positive ⟨b, H''⟩
205+ · rename_i H''
206+ apply strictly_positive ⟨b, H''⟩
183207
184208theorem frac_included {p q : Frac α} : p ≼ q ↔ p < q :=
185209 ⟨ by rintro ⟨r, Hr⟩; exact lt_def.mpr ⟨r, Hr ▸ rfl⟩,
@@ -191,8 +215,4 @@ theorem frac_included {p q : Frac α} : p ≼ q ↔ p < q :=
191215theorem frac_included_weak {p q : Frac α} (H : p ≼ q) : p ≤ q :=
192216 lt_le (frac_included.mp H)
193217
194- theorem one_whole : whole (1 : α) :=
195- ⟨ le_refl,
196- by rintro ⟨b, Hb⟩; exact (le_def.mp Hb).elim (positive ⟨_, ·⟩) (strictly_positive ⟨_, ·⟩)⟩
197-
198218end NumericFractional
0 commit comments