Skip to content

Commit

Permalink
nearest_round_sgn_leq
Browse files Browse the repository at this point in the history
  • Loading branch information
bmtrager committed Apr 27, 2024
1 parent d48936a commit 26d2aa3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions coq/FHE/arith.v
Original file line number Diff line number Diff line change
Expand Up @@ -2564,6 +2564,26 @@ Proof.
* by rewrite /zero /=.
Qed.

Lemma nearest_round_sgn_leq (r : R) :
(Rabs(r - (nearest_round_sgn r)%:~R) <= 1 / 2)%O.
Proof.
rewrite /nearest_round_sgn.
case: (boolP (Order.lt _ _)); intros.
- generalize (nearest_round_leq (- r)); intros.
rewrite -Rabs_Ropp in H.
rewrite /Rminus Rplus_add !Ropp_opp in H.
rewrite opprD !opprK in H.
rewrite /Rminus Rplus_add !Ropp_opp.
eapply Order.POrderTheory.le_trans; cycle 1.
apply H.
rewrite Order.POrderTheory.le_eqVlt.
apply /orP.
left.
apply /eqP.
f_equal.
ring.
- apply nearest_round_leq.
Qed.

Lemma nearest_round_int_leq (p : nat) (a : int) :
p != 0%N ->
Expand Down

0 comments on commit 26d2aa3

Please sign in to comment.