From patchwork Fri Sep 2 07:53:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 918 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp611134wro; Fri, 2 Sep 2022 00:56:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR6WjkPQNLIzS5jtv7xxs3Z7pSZ2VCWyesd3jxhG412M1Q0zfe8icBc2RsSKF2rq8LoEemIY X-Received: by 2002:a17:906:2245:b0:715:7c81:e39d with SMTP id 5-20020a170906224500b007157c81e39dmr27540366ejr.262.1662105387699; Fri, 02 Sep 2022 00:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662105387; cv=none; d=google.com; s=arc-20160816; b=O4Rrdhii5/jsb4LG2aHfiWkAPWNHTTgXUIANOuyltEDKspD1ooNkSXNHf+5grHDnqP Ie3lKGmH6eI0FtIUxnW8AV2HOrqFVMUUIPIPru0U7Y5K53c8f60j6BEjsg2QBufVtpQZ 0qBU0KGT22NNv0pdeBm+xLTKtfoCa073gXqBU0+oeBYdcTE6UApzFwwKepm7DzcsAP6A XzNSyTgYJbFsxCbYteiGcGrRGDA2LP7mMHif6JeceyYSmRuOA1aqMxEuaAfRZx4k2chW LwSmuNN6TamoWn4bGUdO1qhtOTNGHNWCxmPwMvaLfdtrykUL9g0trfcSMoKXPYzVsl9Z eQIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=NSbIJcX2w7frFm06+mbXM59KOCm7+BmBndbrdIG/tIo=; b=BmyhiKxinwXCg3GkZf56O85vSaovyG/l9IHaCydzyDEDs/Qhj2/7kf+5lEaMK5UpeS K+TZ+oyPqM9wXup9BmXD0eLnN7NDtZWiNx4z4kcH+AaNZjF8Mbq/46HQivUxPdy5pzMd hF/8jqrdNle8+otLvVLRt69E+WYV/ZxlwbCdg7+8eQwB2oQvmGT/J6/s8kcdkaex5NU3 9FQ7gth7RgKx+XUQ6132utOnDzrM+nrFFPC0i/Wya0DkwiiuuzoFj1K5U6bik/2MQyQa UUDv+h8BsPMybNzSuynNFEWAATOqzxOfkLUIH6LUPUUwPUV6vBPHQPRx1SxojUKqXJ/o sIwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=V+OcKevO; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id p5-20020a50c945000000b00448b28cac76si1133236edh.483.2022.09.02.00.56.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 00:56:27 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=V+OcKevO; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9CC4E383E053 for ; Fri, 2 Sep 2022 07:55:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9CC4E383E053 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662105312; bh=NSbIJcX2w7frFm06+mbXM59KOCm7+BmBndbrdIG/tIo=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=V+OcKevOB7I6VADBCnHaJWz2JSrn42KZgKZpHRieW8zlr9dZU8AJIqwAROnVFashW TS6lyMrbqyjZ00qd70qdZSNgOWZSpCGUmRd/b9Y0WuqZLuWxY8lem4yAuEjQY6ICGW Vimg/pRUMzgpPbYQ+Ohms00XLwvm2hgvPhsWOcEg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 7EDE43858C74 for ; Fri, 2 Sep 2022 07:53:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7EDE43858C74 Received: by mail-wr1-x435.google.com with SMTP id w5so1198097wrn.12 for ; Fri, 02 Sep 2022 00:53:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=NSbIJcX2w7frFm06+mbXM59KOCm7+BmBndbrdIG/tIo=; b=Ntb79JJcpvZ56iEQ9xYucaE8yoxIY7p+Xgw2Uki7wgkVTdN1BtR6dLi17j2pkmUtTz J3Lwklhu0UHWEpiBqog3sxotaSF7POLdidTxdPuay46gvz9UrWdsDwaaba602i2q535E PVhXkcTYB7VFg+B1cLqG2aXYpJvoXNGw2HrpR9tpxV1wmisz8m0fXeVK+WN/SS+UxSux OfTk2UiACwSyBgE11awXtILX1CWrUb9tdCOgA3EmLzAE7AK/Dy/Ody8MYK65PzXHbdsx X8OuaNnXZt+wKw7I10+nvFCuLYLBRoISMMgOjaYGD9gr/MUg4GjiM+YuJwhQwumjsybc WYww== X-Gm-Message-State: ACgBeo2EgtcnpTrBYSUxKxkZfgUtH/GHd0ExjV5vVa5QVMA5sDXDFBKh Uw9euiBceZSd2svBqUIeqIWZK/aaUuX31w== X-Received: by 2002:a5d:5984:0:b0:227:1a6c:a507 with SMTP id n4-20020a5d5984000000b002271a6ca507mr1630751wri.292.1662105204383; Fri, 02 Sep 2022 00:53:24 -0700 (PDT) Received: from poulhies-Precision-5550 (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id h6-20020a05600c350600b003a541d893desm1409319wmq.38.2022.09.02.00.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 00:53:23 -0700 (PDT) Date: Fri, 2 Sep 2022 09:53:22 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix proof of runtime unit System.Wid_* Message-ID: <20220902075322.GA1121031@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= Cc: Claire Dross Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1742843819294860948?= X-GMAIL-MSGID: =?utf-8?q?1742843819294860948?= Regain the proof of System.Wid_* after changes in provers and Why3. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-widthu.adb (Lemma_Euclidean): Lemma to prove the relation between the quotient/remainder of a division. diff --git a/gcc/ada/libgnat/s-widthu.adb b/gcc/ada/libgnat/s-widthu.adb --- a/gcc/ada/libgnat/s-widthu.adb +++ b/gcc/ada/libgnat/s-widthu.adb @@ -73,6 +73,14 @@ package body System.Width_U is Ghost, Post => X / Y / Z = X / (Y * Z); + procedure Lemma_Euclidian (V, Q, F, R : Big_Integer) + with + Ghost, + Pre => F > 0 and then Q = V / F and then R = V rem F, + Post => V = Q * F + R; + -- Ghost lemma to prove the relation between the quotient/remainder of + -- division by F and the value V. + ---------------------- -- Lemma_Lower_Mult -- ---------------------- @@ -104,6 +112,12 @@ package body System.Width_U is pragma Assert (X / YZ = XYZ + R / YZ); end Lemma_Div_Twice; + --------------------- + -- Lemma_Euclidian -- + --------------------- + + procedure Lemma_Euclidian (V, Q, F, R : Big_Integer) is null; + -- Local variables W : Natural; @@ -152,7 +166,7 @@ package body System.Width_U is R : constant Big_Integer := Big (T_Init) rem F with Ghost; begin pragma Assert (Q < Big_10); - pragma Assert (Big (T_Init) = Q * F + R); + Lemma_Euclidian (Big (T_Init), Q, F, R); Lemma_Lower_Mult (Q, Big (9), F); pragma Assert (Big (T_Init) <= Big (9) * F + F - 1); pragma Assert (Big (T_Init) < Big_10 * F);