def aes_fixed_bytes_identity
qasim-bend-kit@0.1.0.2 · proof/AES_EnvelopeProof.bend:555
import qasim-bend-kit@0.1.0.2/proof/AES_EnvelopeProof.bend as AESEnvelopeProof
import Base
import qasim-bend-kit@0.1.0.2/libs/AES256GCM.bend as AES
555def aes_fixed_bytes_identity(+n: Nat, +bytes: List<&2, U32>,
556 size: {List.length(&2, U32, bytes) == n : Nat}) ->
557 {AES.fixed_bytes(n, bytes) == bytes : List<&2, U32>}:
558 match n bytes:
559 case 0n Nil{}: {==}
560 case 0n byte <> tail:
561 contradiction = Equal.cong(Nat, Bool,
562 x => Nat.is_eq(x, 0n),
563 1n+List.length(&2, U32, tail), 0n, size)
564 Empty.absurd({AES.fixed_bytes(0n, byte <> tail) ==
565 byte <> tail : List<&2, U32>},
566 aes_false_true(contradiction))
567 case 1n+p Nil{}:
568 contradiction = Equal.cong(Nat, Bool,
569 x => Nat.is_eq(x, 0n), 0n, 1n+p, size)
570 Empty.absurd({AES.fixed_bytes(1n+p, Nil{}) == Nil{} :
571 List<&2, U32>},
572 aes_false_true(Equal.sym(Bool, True{}, False{},
573 contradiction)))
574 case 1n+p byte <> tail:
575 tail_size = Equal.cong(Nat, Nat, aes_nat_predecessor,
576 1n+List.length(&2, U32, tail), 1n+p, size)
577 Equal.cong(List<&2, U32>, List<&2, U32>,
578 xs => byte <> xs,
579 AES.fixed_bytes(p, tail), tail,
580 aes_fixed_bytes_identity(p, tail, tail_size))