(** Definitions for use in pre-reified rewriter rules *) Require Import Coq.ZArith.BinInt. Require Import Crypto.Util.ZRange. Require Import Crypto.Util.ZRange.Operations. Local Open Scope bool_scope. Local Open Scope Z_scope. Module ident. Definition literal {T} (v : T) := v. Definition eagerly {T} (v : T) := v. Definition gets_inlined (real_val : bool) {T} (v : T) : bool := real_val. Section cast. Context (cast_outside_of_range : zrange -> BinInt.Z -> BinInt.Z). Definition is_more_pos_than_neg (r : zrange) (v : BinInt.Z) : bool := ((Z.abs (lower r) P) (b : bool) : P := Datatypes.bool_rect (fun _ => P) (t tt) (f tt) b. Definition list_rect {A} P (N : Datatypes.unit -> P) (C : A -> list A -> P -> P) (ls : list A) : P := Datatypes.list_rect (fun _ => P) (N tt) C ls. Definition list_case {A} P (N : Datatypes.unit -> P) (C : A -> list A -> P) (ls : list A) : P := ListUtil.list_case (fun _ => P) (N tt) C ls. Definition nat_rect P (O_case : unit -> P) (S_case : nat -> P -> P) (n : nat) : P := Datatypes.nat_rect (fun _ => P) (O_case tt) S_case n. Definition option_rect {A} P (S_case : A -> P) (N_case : unit -> P) (o : option A) : P := Datatypes.option_rect (fun _ => P) S_case (N_case tt) o. End Thunked. End ident.