Skip to content

Commit baf6c2c

Browse files
committed
change use of subst in favour of equational reasoning
1 parent 8476db7 commit baf6c2c

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/Data/Rational/Unnormalised/Properties.agda

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,16 +1970,17 @@ q<⌊q⌋+1 q@record{} = let n = ↥ q; d = ↧ q in *<* ( begin-strict
19701970
(↥ (⌊ q ⌋ / 1 + 1ℚᵘ)) ℤ.* d ∎) where open ℤ.≤-Reasoning
19711971

19721972
q≤⌈q⌉ : q q ≤ ⌈ q ⌉ / 1
1973-
q≤⌈q⌉ q@record{} = subst
1974-
(_≤ - (⌊ - q ⌋ / 1))
1975-
(neg-involutive-≡ q)
1976-
(neg-mono-≤ (⌊q⌋≤q (- q)))
1973+
q≤⌈q⌉ q@record{} = begin
1974+
q ≡⟨ neg-involutive-≡ q ⟨
1975+
- (- q) ≤⟨ neg-mono-≤ (⌊q⌋≤q (- q)) ⟩
1976+
⌈ q ⌉ / 1where open ≤-Reasoning
19771977

19781978
⌈q⌉-1<q : q ⌈ q ⌉ / 1 - 1ℚᵘ < q
1979-
⌈q⌉-1<q q@record{} = subst₂ _<_
1980-
(neg-distrib-+ (⌊ - q ⌋ / 1) 1ℚᵘ)
1981-
(neg-involutive-≡ q)
1982-
(neg-mono-< (q<⌊q⌋+1 (- q)))
1979+
⌈q⌉-1<q q@record{} = neg-cancel-< (begin-strict
1980+
- q <⟨ q<⌊q⌋+1 (- q) ⟩
1981+
⌊ - q ⌋ / 1 + 1ℚᵘ ≡⟨ neg-involutive-≡ (⌊ - q ⌋ / 1 + 1ℚᵘ) ⟨
1982+
- (- (⌊ - q ⌋ / 1 + 1ℚᵘ)) ≡⟨ cong -_ (neg-distrib-+ (⌊ - q ⌋ / 1) 1ℚᵘ) ⟩
1983+
- (⌈ q ⌉ / 1 - 1ℚᵘ) ∎) where open ≤-Reasoning
19831984

19841985
------------------------------------------------------------------------
19851986
-- Approximation errors of ⌊_⌋ ⌈_⌉ and round(_)

0 commit comments

Comments
 (0)