def
definition
neg
show as:
view math explainer →
open explainer
Read the cached plain-language explainer.
open lean source
IndisputableMonolith.Foundation.RationalsFromLogic on GitHub at line 128.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
-
sub_eq_add -
J_at_phi -
PhiInt -
PhiInt -
canonicalPhiRingObj -
PhiRingHom -
PhiRingObj -
duhamelRemainderOfGalerkin_integratingFactor -
tendsto_duhamelKernelIntegral_of_dominated_convergence -
encodeClause -
clauseUnit -
clauseUnit_correct -
known_lit_false'' -
valueOfLit -
evalLit -
Lit -
mentionsVarLit -
deriv_alphaInv_of_gap -
logarithmic_derivative_constant -
dAlembert_to_ODE_general -
ode_cos_uniqueness -
dAlembert_to_ODE_general -
ode_cos_uniqueness -
dAlembert_to_ODE_general_theorem -
dAlembert_to_ODE_theorem -
dAlembert_to_ODE_theorem -
Jcost_log_second_deriv_normalized -
neg -
ode_cos_unit_uniqueness -
toComplex_neg -
even_function_deriv_zero -
separable_forces_flat_ode -
Gspher_satisfies_spherical -
dalembert_deriv_ode -
neg -
C_RS_minus_C_classical_tendsto_zero -
ode_cos_uniqueness_contdiff -
bet1_boundaryTerm_integrable_of_L2_mul_r -
operatorPairing_of_decayFull -
integral_Ioi_radial_skew_identity
formal source
125instance : One LogicRat := ⟨one⟩
126
127/-- Negation: `-(a/b) = (-a)/b`. -/
128def neg : LogicRat → LogicRat :=
129 Quotient.lift
130 (fun (p : PreRat) => mk (-p.num) p.den p.den_nonzero)
131 (by
132 rintro ⟨a, b, hb⟩ ⟨c, d, hd⟩ h
133 show mk (-a) b hb = mk (-c) d hd
134 apply sound
135 show -a * d = -c * b
136 have h' : a * d = c * b := h
137 rw [eq_iff_toInt_eq, toInt_mul, toInt_mul, toInt_neg, toInt_neg]
138 have h'' : toInt a * toInt d = toInt c * toInt b := by
139 have := congrArg toInt h'
140 rwa [toInt_mul, toInt_mul] at this
141 linarith)
142
143instance : Neg LogicRat := ⟨neg⟩
144
145/-- Addition: `(a/b) + (c/d) = (a*d + c*b) / (b*d)`. -/
146def add : LogicRat → LogicRat → LogicRat :=
147 Quotient.lift₂
148 (fun (p q : PreRat) =>
149 mk (p.num * q.den + q.num * p.den) (p.den * q.den)
150 (fun h => p.den_nonzero ((mul_eq_zero.mp h).resolve_right q.den_nonzero)))
151 (by
152 rintro ⟨a, b, hb⟩ ⟨c, d, hd⟩ ⟨a', b', hb'⟩ ⟨c', d', hd'⟩ hab hcd
153 show mk (a * d + c * b) (b * d) _
154 = mk (a' * d' + c' * b') (b' * d') _
155 apply sound
156 show (a * d + c * b) * (b' * d') = (a' * d' + c' * b') * (b * d)
157 rw [eq_iff_toInt_eq]
158 simp only [toInt_add, toInt_mul]