coq

Coq VST Internal structure copying

大兔子大兔子 提交于 2021-01-28 19:23:39
问题 run into a problem with VST(Verified Software Toolchain) 2.5v library for Coq 8.10.1: Got an error with the latest working commit of VST namely " Internal structure copying is not supported ". Minimal example: struct foo {unsigned int a;}; struct foo f() { struct foo q; return q; } On starting proof got an error: Error: Tactic failure: The expression (_q)%expr contains internal structure-copying, a feature of C not currently supported in Verifiable C (level 97). This is due to the check

Coq VST Internal structure copying

爱⌒轻易说出口 提交于 2021-01-28 19:04:53
问题 run into a problem with VST(Verified Software Toolchain) 2.5v library for Coq 8.10.1: Got an error with the latest working commit of VST namely " Internal structure copying is not supported ". Minimal example: struct foo {unsigned int a;}; struct foo f() { struct foo q; return q; } On starting proof got an error: Error: Tactic failure: The expression (_q)%expr contains internal structure-copying, a feature of C not currently supported in Verifiable C (level 97). This is due to the check

How to use Coq arithmetic solver tactics with SSReflect arithmetic statements

左心房为你撑大大i 提交于 2021-01-28 03:11:21
问题 Coq has some convenient tactics for automatically proving arithmetic lemmas, for instance lia : From Coq Require Import ssreflect ssrfun ssrbool. From mathcomp Require Import ssrnat. Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive. Require Import Psatz. Lemma obv : forall (x y z: nat), (x < y)%coq_nat -> (y < z)%coq_nat -> (z < 3)%coq_nat -> (x < 3)%coq_nat. Proof. move => x y z xlty yltz zlt3. lia. Qed. The tactics do not directly support SSReflect-style

coq tactic for replacing bools with Prop

空扰寡人 提交于 2021-01-28 01:09:37
问题 Is there a proof tactic in coq which takes all the boolean operations in an expression (andb, orb, implb, etc) and replaces them with Propositional connectives (and, or, impl) and encapsulates the boolean variables x in Is_true(x) ? If not, how can I write one? 回答1: You could use a rewrite database, for instance: Require Import Setoid. Require Import Bool. Lemma andb_prop_iff x y: Is_true (x && y) <-> Is_true x /\ Is_true y. Proof. split; [apply andb_prop_elim | apply andb_prop_intro]. Qed.

Prove a match statement

让人想犯罪 __ 提交于 2021-01-27 07:24:08
问题 Trying to solve an exercise, I have the following definition that represents the integers : Inductive bin : Type := | Zero : bin | Twice : bin -> bin | TwiceOne : bin -> bin. The idea is that : Twice x is 2*x . TwiceOne x is 2*x +1 . However, this representation has a problem: there are several representations of the number 0 . Therefore, I need to implement a function that normalize a number writing in bin . To do this I have declared the following function : Fixpoint normalize_bin (b:bin) :

Prove a match statement

爷,独闯天下 提交于 2021-01-27 07:20:34
问题 Trying to solve an exercise, I have the following definition that represents the integers : Inductive bin : Type := | Zero : bin | Twice : bin -> bin | TwiceOne : bin -> bin. The idea is that : Twice x is 2*x . TwiceOne x is 2*x +1 . However, this representation has a problem: there are several representations of the number 0 . Therefore, I need to implement a function that normalize a number writing in bin . To do this I have declared the following function : Fixpoint normalize_bin (b:bin) :

数独高阶技巧之八——SDC

半城伤御伤魂 提交于 2021-01-09 07:06:57
在本系列的第四篇“ 简单异数链 ”中,向大家介绍了XY-Wing等一系列Wing类技巧,并提到可以用(拐弯的)数组的观念来理解这些结构,经过第六篇 ALS 的学习之后,大家回过头再去看Wing,应该可以发现相关的实例都可以用ALS去解释。本篇则要介绍一种与上述结构类似的删除技巧——SDC(Sue de Coq)。 一、基本形态 Sue de Coq这个命名来自于SDC技巧最早发现者的论坛昵称,更正式的名称应该是Two-Sector Disjoint Subsets(双分离子集删除法),我们先来看SDC的两种基本形态。 图1 SDC-01 图1中,B4和R5深色背景4个待解格中存在且仅存在(A、B、C、D)4个候选数,可将这4个候选数分成红(A、B)、绿(C、D)两个分离子集(红∩绿=Ø),将4个待解格按其所在单元分为宫B、行R两个子集,红色(A、B)存在于子集B三格中,绿色(C、D)存在于子集R三格中,两个待解格子集存在交集X(交叠区域两格,X=B∩R), X中的候选数为红、绿两个候选数分离子集的并集,若满足这些条件,红、绿两个子集可各自对所在单元其他格内的候选数进行摈除 。 为什么可以这样删数呢?以ALS的视角来看原理很简单,将这四格按所在单元分为宫、行两组ALS( 每组都是3格4数 ),此时: 1、若宫行相交区域的A、B都不成立,则R5深色3格中只能填入C、D两个候选数