coq


Re-writing without using symmetry tactic


This is the coq version I'm using:
sibi { ~ }-> coqc --version
The Coq Proof Assistant, version 8.4pl4 (November 2015)
compiled on Nov 04 2015 12:56:53 with OCaml 4.02.3
This is the theorem I'm trying to prove:
Require Import Coq.Lists.List.
Import ListNotations.
Theorem rev_app_distr: forall l1 l2 : list nat,
rev (l1 ++ l2) = rev l2 ++ rev l1.
Proof.
Note that I will use this theorem in the proof (which has already been proved by me):
Theorem app_nil_r : forall l : list nat,
l ++ [] = l.
Ok, now this is my attempt to prove the theorem via the usual induction way:
Theorem rev_app_distr: forall l1 l2 : list nat,
rev (l1 ++ l2) = rev l2 ++ rev l1.
Proof.
intros l1 l2.
induction l1 as [| n l1'].
- simpl.
rewrite -> app_nil_r with (l := rev l2) at 2.
But on executing the rewrite tactic, it gives me the following error:
Error: Tactic failure:Nothing to rewrite.
But If I use symmetry tactic, I can actually prove it via the same code:
Theorem rev_app_distr: forall l1 l2 : list nat,
rev (l1 ++ l2) = rev l2 ++ rev l1.
Proof.
intros l1 l2.
induction l1 as [| n l1'].
- simpl.
symmetry.
rewrite -> app_nil_r with (l := rev l2) at 1.
So, why does rewriting it without symmetry doesn't work ?
The problem is not that you were missing the symmetry call, but that you added the at 2 modifier when invoking the tactic. Since the goal at that point has only one occurrence of the left-hand side of app_nil_r (that is, rev l2 ++ []), the rewrite tactic gets confused and does not do anything. If you replace at 2 by at 1, or simply delete it, the problem goes away. You can learn more about the at modifier in the Coq manual.

Related Links

Idiomatically expressing “The Following Are Equivalent” in Coq
What are the possible ways to define parallel composition in Coq apart from using list?
Defining a finite automata Coq
Proving even + even = even with mutual induction using tactics
Rewriting hypothesis with a more concrete expression
Coq rewriting using lambda arguments
How to rewrite a goal using function definition?
coqtop -lv (version 8.6) no longer displaying proof subgoals?
Coq beginner - Prove a basic lemma
How to do induction differently?
Is is possible to implement a Coq tactic that inspects a HintDb? If so, how?
Need help on proving proposition in Coq
Folding back after unfolding
Could coq derive this solution automatically? Can coq manipulate algebraic expressions when performing the search for a proof?
A special case of Lob's theorem using Coq
How can I implement a coq tactic that iterates over the hypotheses?

Categories

HOME
analysis
win32gui
fsm
disassembler
ezpublish
flyway4
adfs
session-variables
maude-system
imacros
modx-revolution
jplayer
ups
quartz-scheduler
serverless-framework
django-simple-history
oxyplot
excel-vba-mac
crystal-reports-2008
nodatime
plunker
immutable.js
autoconf
language-agnostic
zurb-foundation-6
format-specifiers
claims-based-identity
emgucv
sqlcipher
one-to-many
su
info.plist
fgetcsv
primitive
nameservers
twilio-api
pdb
google-qpx-express-api
amazon-kinesis-kpl
android-ble
ios5
io-redirection
dosbox
hot-module-replacement
service-discovery
code-search-engine
ws-security
mapzen
fedex
ncalc
ibpy
firebase-admin
isbn
arena-simulation
eclipse-gef
sencha-touch-2.3
jsch
python-webbrowser
recursive-datastructures
jspdf-autotable
titanium-android
gnome-shell-extensions
vmware-tools
ctest
bstr
gridview-sorting
python-stackless
0xdbe
arcanist
sysinternals
iiviewdeckcontroller
p2
bigbluebutton
asp.net-web-api-odata
gulp-less
websocket4net
internet-connection
xojo
system.net.webexception
jboss-weld
datagridviewcolumn
centos5
fmod
uv-mapping
.aspxauth
listings
tws
flash-builder4.5
ora-00911
random-seed
enterprisedb
flashvars
dmoz
mt
venn-diagram
propertyeditor
multipage
armcc
removeclass
gwt-ext
winbugs14
mysql-error-1005
sortable-tables
dbal
asp.net-profiles
ncqrs
backcolor
privilege
defensive-programming

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App