Theory arithmetic_right_shift

(*
 * Copyright (c) 2024 Apple Inc. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 *)

theory arithmetic_right_shift
imports "AutoCorres2.CTranslation"
begin

declare [[arithmetic_right_shift]]
install_C_file "arithmetic_right_shift.c"

context arithmetic_right_shift_global_addresses
begin
unbundle f_variables
lemma "Γ ⊢ ⦃ -1 = ´c ⦄ ´ret' :== CALL f() ⦃ ´ret' = -1 ⦄"
  by vcg (auto simp: sshiftr_n1)

end

context arithmetic_right_shift_global_addresses
begin
unbundle g_variables

lemma "Γ ⊢ ⦃ u = ´u ⦄ ´ret' :== CALL g() ⦃ ´ret' = u >> 5 ⦄"
  by vcg simp_all

end

end