Library Waterproof.Automation.Hints
Require Import Ltac2.Ltac2.
Require Import Arith.PeanoNat.
Require Import Classical_Pred_Type.
Require Import Lia.
Require Import Lra.
Require Import Logic.ClassicalEpsilon.
Require Import Reals.Reals.
Require Import Reals.Rdefinitions.
Require Import Sets.Classical_sets.
Require Import Sets.Ensembles.
Require Import Notations.Sets.
Require Import Chains.
Require Import Libs.Negation.
Require Import Libs.Reals.
Require Import Libs.Logic.InformativeEpsilon.
Require Import Libs.Logic.ConstructiveLogic.
Create HintDb wp_core.
#[export] Hint Resolve f_equal : wp_core.
#[export] Hint Resolve f_equal2 : wp_core.
#[export] Hint Extern 2 => progress ltac2:(simpl_ineq_chains ()) : wp_core.
#[export] Hint Extern 1 ( _ = _ ) => progress ltac2:(simpl_ineq_chains ()); congruence 20 : wp_core.
#[export] Hint Extern 2 => progress (unfold seal, subset_type, gt_op, R_gt_type, nat_gt_type, ge_op, R_ge_type, nat_ge_type,
lt_op, R_lt_type, nat_lt_type, le_op, R_le_type, nat_le_type in * ) : wp_core.
#[export] Hint Extern 2 => progress (unfold subset_in, conv, as_subset in * ) : wp_core.
#[export] Hint Resolve mem_subset_full_set : wp_core.
#[export] Hint Extern 3 => progress ltac2:(split_conjunctions ()) : wp_core.
Create HintDb wp_definitions.
Create HintDb wp_classical_logic.
Create HintDb wp_negation_logic.
#[export] Hint Extern 1 => ltac2:(solve_by_manipulating_negation (fun () => ())) : wp_negation_logic.
Create HintDb wp_constructive_logic.
#[export] Hint Resolve not_ex_all_not : wp_constructive_logic.
#[export] Hint Resolve ex_not_not_all : wp_constructive_logic.
#[export] Hint Resolve all_not_not_ex : wp_constructive_logic.
Create HintDb wp_decidability_epsilon.
#[export] Hint Resolve excluded_middle_informative : wp_decidability_epsilon.
#[export] Hint Resolve informative_or_lift : wp_decidability_epsilon.
Create HintDb wp_decidability_classical.
#[export] Hint Resolve classic : wp_decidability_classical.
Create HintDb wp_decidability_constructive.
#[export] Hint Resolve make_sumbool_uninformative_1 : wp_decidability_constructive.
#[export] Hint Resolve make_sumbool_uninformative_2 : wp_decidability_constructive.
#[export] Hint Resolve make_sumtriad_uninformative_1 : wp_decidability_constructive.
#[export] Hint Resolve make_sumtriad_uninformative_2 : wp_decidability_constructive.
#[export] Hint Resolve make_sumtriad_uninformative_3 : wp_decidability_constructive.
#[export] Hint Resolve make_sumtriad_uninformative_4 : wp_decidability_constructive.
#[export] Hint Resolve make_sumtriad_uninformative_5 : wp_decidability_constructive.
#[export] Hint Resolve make_sumtriad_uninformative_6 : wp_decidability_constructive.
Create HintDb wp_decidability_nat.
#[export] Hint Resolve Nat.eq_dec : wp_decidability_nat.
#[export] Hint Extern 1 => lia : wp_decidability_nat.
Create HintDb wp_decidability_reals.
Automatically unfold > to <so (_ > _) no longer has to occur in the options below.
We cannot do the same for >= as it is not defined as <=.
#[export] Hint Extern 1 => unfold Rgt : wp_decidability_reals.
#[export] Hint Extern 1 => lra : wp_decidability_reals.
#[export] Hint Resolve Req_EM_T : wp_decidability_reals.
#[export] Hint Resolve Rlt_le_dec : wp_decidability_reals.
#[export] Hint Resolve Rgt_ge_dec : wp_decidability_reals.
#[export] Hint Extern 1 => lra : wp_decidability_reals.
#[export] Hint Resolve Req_EM_T : wp_decidability_reals.
#[export] Hint Resolve Rlt_le_dec : wp_decidability_reals.
#[export] Hint Resolve Rgt_ge_dec : wp_decidability_reals.
Lemmas to write e.g.
{r1 ≤ r2} + {~r2 ≥ r1}
#[export] Hint Resolve Rlt_dec Rle_dec Rge_dec : wp_decidability_reals.
#[export] Hint Resolve Rle_lt_dec Rge_gt_dec : wp_decidability_reals.
#[export] Hint Resolve Rle_lt_or_eq_dec : wp_decidability_reals.
#[export] Hint Resolve Rge_lt_or_eq_dec : wp_decidability_reals.
#[export] Hint Resolve Rle_lt_dec Rge_gt_dec : wp_decidability_reals.
#[export] Hint Resolve Rle_lt_or_eq_dec : wp_decidability_reals.
#[export] Hint Resolve Rge_lt_or_eq_dec : wp_decidability_reals.
x < y
, x = y
or y < x
#[export] Hint Resolve total_order_T : wp_decidability_reals.
lemmas to relate <= with >= and < with >
#[export] Hint Resolve Rge_le : wp_decidability_reals.
#[export] Hint Resolve Rle_ge : wp_decidability_reals.
#[export] Hint Resolve Rgt_lt : wp_decidability_reals.
#[export] Hint Resolve Rlt_gt : wp_decidability_reals.
#[export] Hint Resolve Rle_ge : wp_decidability_reals.
#[export] Hint Resolve Rgt_lt : wp_decidability_reals.
#[export] Hint Resolve Rlt_gt : wp_decidability_reals.
Create HintDb wp_eq_plus.
Create HintDb wp_eq_mult.
x * y = y * x
Associativity
We have the following associative properties
x * y * z = x * (y * z)
x * (y+z) = x * y + x * z
(x+y) * z = x * z + y * z
x + y = y + x
x + y + z = x + (y + z)
#[export] Hint Extern 1 => (rewrite Rplus_assoc) : wp_eq_plus.
#[export] Hint Extern 1 => (rewrite Rdiv_plus_distr) : wp_eq_plus.
#[export] Hint Extern 1 => (rewrite Rmult_plus_distr_l) : wp_eq_plus.
#[export] Hint Extern 1 => (rewrite Rmult_plus_distr_r) : wp_eq_plus.
#[export] Hint Extern 1 => (rewrite Rdiv_plus_distr) : wp_eq_plus.
#[export] Hint Extern 1 => (rewrite Rmult_plus_distr_l) : wp_eq_plus.
#[export] Hint Extern 1 => (rewrite Rmult_plus_distr_r) : wp_eq_plus.
Create HintDb wp_eq_opp.
- (x - y) = y - x
- (y - x) = x - y
- (x * y) = - x * y
- (x * y) = x * - y
- x * y = - (x * y)
x * - y = - (x * y)
- (x + y) = - x + - y
--a = a
-a * -b = a * b
- a / b = - (a / b)
-a + a = 0
a + -a = 0
Create HintDb wp_eq_minus.
(x - y) / z = x / z - y / z
#[export] Hint Extern 1 => (rewrite Rdiv_minus_distr) : wp_eq_minus.
#[export] Hint Extern 1 => (unfold Rminus) : wp_eq_minus.
#[export] Hint Extern 1 => (unfold Rminus) : wp_eq_minus.
Create HintDb wp_eq_zero.
0 + x = x
x + 0 = x
0 - x = - x
x - 0 = x
0 * x = 0
x * 0 = 0
x ^ 0 = 1
Create HintDb wp_eq_one.
1 * x = x
x * 1 = x
x / 1 = x
x ^ 1 = x
/ / x = x
Create HintDb wp_eq_abs.
||a - a|| = 0
||a * b - a * c|| = ||a|| * ||b - c||
||a - b|| = ||b - a||
|a - b| = |b - a|, using Rabs
| |a| | = |a|
|-a| = |a|
|a * b| = |a| * |b|
a^2 = |a|^2
sqrt(a^2) = |a|
| a |^2 = a^2
Create HintDb wp_eq_sqr.
a² = a ^ 2
(a-b)² = a² + b² + 2*a*b
(a+b)*(a-b) = a² - b²
(a-b)² = a² + b² - 2*a*b
(a-b)*(a+b) = a² - b²
a² = (-a)²
(a-b)² = (b-a)²
(a*b)² = a² * b²
Create HintDb wp_eq_exp.
ln (exp a)) = a
exp (-a) = / exp a
exp(a+b) = exp(a) * exp(b)
ln (exp a)) = a
Create HintDb wp_integers.
#[export] Hint Extern 3 ( _ = _ ) => ring : wp_integers.
#[export] Hint Extern 1 ( @eq nat _ _) => cbn; ltac2:(simpl_ineq_chains ()); lia : wp_integers.
#[export] Hint Extern 1 ( le _ _ ) => cbn; ltac2:(simpl_ineq_chains ()); lia : wp_integers.
#[export] Hint Extern 1 ( ge _ _ ) => cbn; ltac2:(simpl_ineq_chains ()); lia : wp_integers.
#[export] Hint Extern 1 ( lt _ _ ) => cbn; ltac2:(simpl_ineq_chains ()); lia : wp_integers.
#[export] Hint Extern 1 ( gt _ _ ) => cbn; ltac2:(simpl_ineq_chains ()); lia : wp_integers.
Create HintDb wp_negation_int.
#[export] Hint Extern 1 => ltac2:(solve_by_manipulating_negation (fun () => ltac1:(lia))) : wp_negation_int.
Create HintDb wp_negation_nat.
#[export] Hint Extern 1 => ltac2:(solve_by_manipulating_negation (fun () => ltac1:(lia))) : wp_negation_nat.
Create HintDb wp_reals.
#[export] Hint Extern 2 => ltac2:(simpl_member_subset ()); lra : wp_reals.
#[export] Hint Extern 1 (pred R _ _) => simpl; lra : wp_reals.
#[export] Hint Extern 3 ( @eq R _ _ ) => field : wp_reals.
#[export] Hint Extern 1 ( Rle _ _ ) => lra : wp_reals.
#[export] Hint Extern 1 ( Rge _ _ ) => lra : wp_reals.
#[export] Hint Extern 1 ( Rlt _ _ ) => lra : wp_reals.
#[export] Hint Extern 1 ( Rgt _ _ ) => lra : wp_reals.
#[export] Hint Extern 1 (~ (Rle _ _) ) => lra : wp_reals.
#[export] Hint Extern 1 (~ (Rge _ _) ) => lra : wp_reals.
#[export] Hint Extern 1 (~ (Rlt _ _) ) => lra : wp_reals.
#[export] Hint Extern 1 (~ (Rgt _ _) ) => lra : wp_reals.
#[export] Hint Extern 1 (~ (@eq R _ _ ) ) => lra : wp_reals.
#[export] Hint Extern 2 ( @eq R _ _ ) => ltac2:(crush_R_abs_min_max ()): wp_reals.
#[export] Hint Extern 2 ( Rle _ _ ) => ltac2:(crush_R_abs_min_max ()) : wp_reals.
#[export] Hint Extern 2 ( Rge _ _ ) => ltac2:(crush_R_abs_min_max ()) : wp_reals.
#[export] Hint Extern 2 ( Rlt _ _ ) => ltac2:(crush_R_abs_min_max ()) : wp_reals.
#[export] Hint Extern 2 ( Rgt _ _ ) => ltac2:(crush_R_abs_min_max ()) : wp_reals.
#[export] Hint Extern 3 (~ (Rle _ _) ) => cbn; ltac2:(crush_R_abs_min_max ()) : wp_reals.
#[export] Hint Extern 3 (~ (Rge _ _) ) => cbn; ltac2:(crush_R_abs_min_max ()); lra : wp_reals.
#[export] Hint Extern 3 (~ (Rlt _ _) ) => cbn; ltac2:(crush_R_abs_min_max ()); lra : wp_reals.
#[export] Hint Extern 3 (~ (Rgt _ _) ) => cbn; ltac2:(crush_R_abs_min_max ()); lra : wp_reals.
#[export] Hint Extern 3 (~ (@eq R _ _ ) ) => cbn; ltac2:(crush_R_abs_min_max ()); lra : wp_reals.
#[export] Hint Extern 3 ( Rle _ _ ) => nra : wp_reals.
#[export] Hint Extern 3 ( Rge _ _ ) => nra : wp_reals.
#[export] Hint Extern 3 ( Rlt _ _ ) => nra : wp_reals.
#[export] Hint Extern 3 ( Rgt _ _ ) => nra : wp_reals.
#[export] Hint Resolve eq_sym : wp_reals.
#[export] Hint Resolve false_Req : wp_reals.
#[export] Hint Resolve true_Req : wp_reals.
#[export] Hint Resolve Rmin_l : wp_reals.
#[export] Hint Resolve Rmin_r : wp_reals.
#[export] Hint Resolve Rmax_l : wp_reals.
#[export] Hint Resolve Rmax_r : wp_reals.
#[export] Hint Resolve Rle_max_compat_l : wp_reals.
#[export] Hint Resolve Rle_max_compat_r : wp_reals.
#[export] Hint Resolve Rmax_lub : wp_reals.
#[export] Hint Resolve Rmax_lub_lt : wp_reals.
#[export] Hint Resolve Rmax_left : wp_reals.
#[export] Hint Resolve Rmax_right : wp_reals.
#[export] Hint Resolve Rmin_left : wp_reals.
#[export] Hint Resolve Rmin_right : wp_reals.
#[export] Hint Resolve Rmin_glb : wp_reals.
#[export] Hint Resolve Rmin_glb_lt : wp_reals.
lemmas to relate <= with >= and < with >
#[export] Hint Resolve Rle_ge : wp_reals.
#[export] Hint Resolve Rlt_gt : wp_reals.
#[export] Hint Resolve div_sign_flip : wp_reals.
#[export] Hint Resolve div_pos : wp_reals.
#[export] Hint Resolve inv_remove : wp_reals.
#[export] Hint Resolve Rinv_inv : wp_reals.
#[export] Hint Resolve Rabs_def1 : wp_reals.
#[export] Hint Resolve Rabs_le : wp_reals.
#[export] Hint Resolve Rabs_left : wp_reals.
#[export] Hint Resolve Rabs_minus_sym : wp_reals.
#[export] Hint Resolve Rabs_right : wp_reals.
#[export] Hint Resolve Rabs_left1 : wp_reals.
#[export] Hint Resolve Rabs_left1_with_minus : wp_reals.
#[export] Hint Resolve Rabs_pos_lt : wp_reals.
#[export] Hint Resolve Rabs_Rabsolu : wp_reals.
#[export] Hint Resolve Rabs_zero : wp_reals.
#[export] Hint Resolve Rle_abs : wp_reals.
#[export] Hint Resolve Rabs_pos : wp_reals.
#[export] Hint Resolve Rle_abs_min : wp_reals.
#[export] Hint Resolve Rge_min_abs : wp_reals.
#[export] Hint Resolve Rmax_abs : wp_reals.
#[export] Hint Resolve Rinv_0_lt_compat : wp_reals.
#[export] Hint Resolve Rplus_lt_compat : wp_reals.
#[export] Hint Resolve Rplus_lt_le_compat : wp_reals.
#[export] Hint Extern 1 => rewrite Rabs_zero : wp_reals.
#[export] Hint Resolve Rlt_gt : wp_reals.
#[export] Hint Resolve div_sign_flip : wp_reals.
#[export] Hint Resolve div_pos : wp_reals.
#[export] Hint Resolve inv_remove : wp_reals.
#[export] Hint Resolve Rinv_inv : wp_reals.
#[export] Hint Resolve Rabs_def1 : wp_reals.
#[export] Hint Resolve Rabs_le : wp_reals.
#[export] Hint Resolve Rabs_left : wp_reals.
#[export] Hint Resolve Rabs_minus_sym : wp_reals.
#[export] Hint Resolve Rabs_right : wp_reals.
#[export] Hint Resolve Rabs_left1 : wp_reals.
#[export] Hint Resolve Rabs_left1_with_minus : wp_reals.
#[export] Hint Resolve Rabs_pos_lt : wp_reals.
#[export] Hint Resolve Rabs_Rabsolu : wp_reals.
#[export] Hint Resolve Rabs_zero : wp_reals.
#[export] Hint Resolve Rle_abs : wp_reals.
#[export] Hint Resolve Rabs_pos : wp_reals.
#[export] Hint Resolve Rle_abs_min : wp_reals.
#[export] Hint Resolve Rge_min_abs : wp_reals.
#[export] Hint Resolve Rmax_abs : wp_reals.
#[export] Hint Resolve Rinv_0_lt_compat : wp_reals.
#[export] Hint Resolve Rplus_lt_compat : wp_reals.
#[export] Hint Resolve Rplus_lt_le_compat : wp_reals.
#[export] Hint Extern 1 => rewrite Rabs_zero : wp_reals.
Create HintDb wp_negation_reals.
#[export] Hint Extern 1 => ltac2:(solve_by_manipulating_negation (fun () => ltac1:(lra))) : wp_negation_reals.
Create HintDb wp_sets.
#[export] Hint Resolve left_in_closed_open : wp_sets.
#[export] Hint Constructors Union Intersection Disjoint Full_set : wp_sets.
Create HintDb wp_intuition.
#[export] Hint Extern 8 => intuition (auto 2 with core): wp_intuition.