diff options
author | Yannick Moy <moy@adacore.com> | 2022-01-04 10:37:53 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-01-11 13:24:47 +0000 |
commit | 371b4ad7c423891d13f9b855f5fdd469a82f7160 (patch) | |
tree | 51bb4cd8aebbe7996e86ed6785e69f5730e859c8 | |
parent | 42c54add83708c37b350c71a2979f2d7483a1656 (diff) | |
download | gcc-371b4ad7c423891d13f9b855f5fdd469a82f7160.zip gcc-371b4ad7c423891d13f9b855f5fdd469a82f7160.tar.gz gcc-371b4ad7c423891d13f9b855f5fdd469a82f7160.tar.bz2 |
[Ada] Adapt ghost code to maintain proof
gcc/ada/
* libgnat/s-expmod.adb (Exp_Modular): Add assertions.
-rw-r--r-- | gcc/ada/libgnat/s-expmod.adb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/ada/libgnat/s-expmod.adb b/gcc/ada/libgnat/s-expmod.adb index 61faed1..60d86e5 100644 --- a/gcc/ada/libgnat/s-expmod.adb +++ b/gcc/ada/libgnat/s-expmod.adb @@ -278,6 +278,7 @@ is (Big (Result) * Big (Factor) ** (Exp - 1), Big (Left) ** Right)); Lemma_Exp_Expand (Big (Factor), Exp - 1); + pragma Assert (Exp / 2 = (Exp - 1) / 2); end if; Lemma_Exp_Expand (Big (Factor), Exp); @@ -286,6 +287,8 @@ is exit when Exp = 0; Rest := Big (Factor) ** Exp; + pragma Assert (Equal_Modulo + (Big (Result) * (Rest * Rest), Big (Left) ** Right)); Lemma_Exp_Mod (Big (Factor) * Big (Factor), Exp, Big (Modulus)); pragma Assert ((Big (Factor) * Big (Factor)) ** Exp = Rest * Rest); |