Coq依赖于重写的类型错误(Coq - dependent type error in rewrite)
我正在使用数学组件库,我试图证明这一点:
Lemma card_sub_ord (k : nat) (P : nat -> bool) : #|[set i : 'I_k | P i]| <= k. Proof. set S := [set i : 'I_k | P i]. have H1 : S \subset 'I_k. by apply: subset_predT. have H2 : #|S| <= #|'I_k|. by apply: subset_leq_card. have H3 : k = #|'I_k|. by rewrite card_ord. (* Only goal left: #|S| <= k *) rewrite H3 (* <--- this fails *) Admitted.
最后一次重写失败,并显示错误消息:
错误:重写时的依赖类型错误
(fun _pattern_value_ : nat => is_true (#|S| <= _pattern_value_)
有关为什么重写失败或对此错误消息的解释的任何想法?
I am using the Mathematical Components library and I am trying to prove this:
Lemma card_sub_ord (k : nat) (P : nat -> bool) : #|[set i : 'I_k | P i]| <= k. Proof. set S := [set i : 'I_k | P i]. have H1 : S \subset 'I_k. by apply: subset_predT. have H2 : #|S| <= #|'I_k|. by apply: subset_leq_card. have H3 : k = #|'I_k|. by rewrite card_ord. (* Only goal left: #|S| <= k *) rewrite H3 (* <--- this fails *) Admitted.
The last rewrite fails with an error message:
Error: dependent type error in rewrite of
(fun _pattern_value_ : nat => is_true (#|S| <= _pattern_value_)
Any idea on why the rewrite fails or an explanation of this error message?
原文:https://stackoverflow.com/questions/43919377
最满意答案
在文件夹中插入文件时 ,需要在文件的
parents
属性中指定正确的文件夹ID。 使用Python:folder_id = '0BwwA4oUTeiV1TGRPeTVjaWRDY1E' file_metadata = { 'name' : 'photo.jpg', 'parents': [ folder_id ] } media = MediaFileUpload('files/photo.jpg', mimetype='image/jpeg', resumable=True) file = drive_service.files().create(body=file_metadata, media_body=media, fields='id').execute() print 'File ID: %s' % file.get('id')
正如在Files:insert中进一步提到的那样,在请求体中设置
parents[]
属性会将文件放在所有提供的文件夹中。 如果parents[]
字段中没有提供文件夹,则该文件将放在默认的根文件夹中。希望有所帮助!
In inserting a file in a folder, you need to specify the correct folder ID in the
parents
property of the file. Using Python:folder_id = '0BwwA4oUTeiV1TGRPeTVjaWRDY1E' file_metadata = { 'name' : 'photo.jpg', 'parents': [ folder_id ] } media = MediaFileUpload('files/photo.jpg', mimetype='image/jpeg', resumable=True) file = drive_service.files().create(body=file_metadata, media_body=media, fields='id').execute() print 'File ID: %s' % file.get('id')
As further mentioned in Files: insert, setting the
parents[]
property in the request body will put the file in all of the provided folders. If no folders are provided inparents[]
field, the file will be placed in the default root folder.Hope that helps!
相关问答
更多-
通过API使用python将一个文件上传到多文件夹google驱动程序(Upload one file to multi folder google driver via API with python)[2022-05-10]
在文件夹中插入文件时 ,需要在文件的parents属性中指定正确的文件夹ID。 使用Python: folder_id = '0BwwA4oUTeiV1TGRPeTVjaWRDY1E' file_metadata = { 'name' : 'photo.jpg', 'parents': [ folder_id ] } media = MediaFileUpload('files/photo.jpg', mimetype='image/jpeg', ... -
我解决了它(通过在另一个问题上找到答案): 而不是File file = service.Files.Insert(body).fetch(); (很多人说这不起作用,),使用File file = service.Files.Insert(body)。 执行 (); Upvote(或论此论坛有效)答案如下: 在Google Drive .NET上创建文件夹 码: File body = new File(); body.Title = "document title"; b ...
-
您只需使用“驱动器插入”创建文件夹,然后使用“插入媒体内容”上载每个文件,并指定相应的文件夹ID作为父文件夹。 详细信息和示例代码位于https://developers.google.com/drive/v2/reference/files/insert You simply have to use Drive Insert to create the folders, then Insert with media content to upload each file, specifying the a ...
-
如何使用Python使用驱动器API将文件上传到谷歌驱动器?(How do I upload file to google drive using drive API using python?)[2023-08-19]
为了访问私人用户数据,您需要获得用户的许可。 未经我的许可,您无法上传到我的云端硬盘帐户。 用户名密码 被称为基本身份验证 ,并在2015年使用谷歌关闭的登录名和密码。 现在为了访问私人用户数据,您需要使用Oauth2。 我建议从Python快速入门开始 """ Shows basic usage of the Drive v3 API. Creates a Drive v3 API service and prints the names and ids of the last 10 files the ... -
您的网址存在问题。 丢失?uploadType=multipart因为这不适合创建文件夹 - “upload”是对文件内容的引用,文件夹没有内容。 There is a problem with your URL. Lose the ?uploadType=multipart as this isn't appropriate for creating a folder - "upload" is a reference to a file's content and a folder has no con ...
-
您在错误的位置添加“文件夹”。 请注意,Google云端存储没有真正的文件夹或目录(请参阅命名部分的最后一个章节)。 模拟目录实际上只是一个名称中带有前缀的对象。 例如,而不是你现在拥有的: bucket = bucket / folderName object = objectname 你会想要: 桶=桶 object = folderName / objectname 对于您的代码,我认为这应该工作: bucket = storage_client.get_bucket(bucket_name) blo ...
-
您遇到' 资源对象没有属性插入 ',因为您使用的是Google Drive API v3。 方法'files.insert'仅适用于Drive API v2。 您可以使用' files.create '而不是' files.insert '。 有关详情,请访问以下链接: https : //developers.google.com/drive/v3/web/migration You're encountering 'Resource object has no attribute insert' bec ...
-
我相信你应该发送包含parents提交的元数据JSON。 就像是: { "parents" : [path_id] } 您可以在此处尝试此API: https : //developers.google.com/drive/v2/reference/files/insert I believe you should send a metadata JSON including a parents filed. Something like: { "parents" : [path_id] ...
-
通过进一步的调查,我设法找到了我的问题的答案。 实际上,遗憾的是,您目前无法在appdata文件夹中放置实时文件。 这是我们正在考虑添加的内容,但在大多数情况下它没有意义,因为appdata文件夹的内容仅限于单个用户。 Cheryl Simon在Google云端硬盘开发者面前发帖 - https://plus.google.com/communities/107264319205603895037 Through further investigation I have managed to find th ...
-
python上传文件到与我共享的google驱动器文件夹(python upload file to google drive folder that is shared with me)[2022-03-16]
您正在使用的API已弃用。 请改用google-api-python-client 。 按照这个官方的python快速入门指南 ,只需将文件上传到文件夹即可。 另外,在请求体中发送parent参数,如下所示: body['parents'] = [{'id': parent_id}] 或者,您可以使用PyDrive ,这是一个Python包装程序库,它简化了许多处理Google Drive API的工作。 整个代码就像这样简单: from pydrive.auth import GoogleAuth fro ...