Require Export aes.spec_utils_LL.
Require Export aes.tablesLL.
Local Open Scope Z.
Definition mbed_tls_fround_col (col0 col1 col2 col3 : int) (rk : Z) : int :=
(Int.xor (Int.xor (Int.xor (Int.xor (Int.repr rk)
(Znth (byte0 col0) FT0))
(Znth (byte1 col1) FT1))
(Znth (byte2 col2) FT2))
(Znth (byte3 col3) FT3)).
Definition mbed_tls_final_fround_col (col0 col1 col2 col3 : int) (rk : Z) : int :=
(Int.xor (Int.xor (Int.xor (Int.xor (Int.repr rk)
(Znth (byte0 col0) FSb)              )
(Int.shl (Znth (byte1 col1) FSb) (Int.repr 8)))
(Int.shl (Znth (byte2 col2) FSb) (Int.repr 16)))
(Int.shl (Znth (byte3 col3) FSb) (Int.repr 24))).
Definition four_ints := (int * (int * (int * int)))%type.
Definition col (i : Z) (s : four_ints) : int := match i with
| 0 => fst s
| 1 => fst (snd s)
| 2 => fst (snd (snd s))
| 3 => snd (snd (snd s))
| _ => Int.zero (* should not happen *)
end.

(* Specifications: *)
Lemma split_four_ints: forall (S: four_ints),
S = (col 0 S, (col 1 S, (col 2 S, col 3 S))).
Lemma split_four_ints_eq: forall S c0 c1 c2 c3,
S = (c0, (c1, (c2, c3))) -> c0 = col 0 S /\ c1 = col 1 S /\ c2 = col 2 S /\ c3 = col 3 S.