Comments (10)
I guess I hit the same issue.
The following works:
Equations foo (n : nat) : nat :=
foo n := bar (S n)
where bar (n : nat) : nat :=
bar n := n.
This snippet
Equations foo (n : nat) : nat :=
foo n := bar (S n)
where bar (n : nat) : nat :=
bar O := O;
bar (S n) := bar n.
produces the following error message:
Error: The variable bar was not found in the current environment.
pointing to the bar (S n) := bar n.
clause as the source of the error.
When adding curly braces like so
Equations foo (n : nat) : nat := {
foo n := bar (S n) }
where bar (n : nat) : nat :=
bar O := O;
bar (S n) := bar n.
the error message stays the same, but this time the line that gets marked as the source is foo n := bar (S n) }
.
from coq-equations.
from coq-equations.
I've tried that, it didn't work:
Equations foo (n : nat) : nat := {
foo n := bar (S n) }
where bar (n : nat) : nat := {
bar O := O;
bar (S n) := bar n }.
from coq-equations.
It only works if bar
mentiones foo
:
Equations foo (n : nat) : nat := {
foo n := bar n }
where bar (n : nat) : nat := {
bar O := O;
bar (S n) := foo n }.
However, if I remove the braces it fails again:
Fail Equations foo (n : nat) : nat :=
foo n := bar n
where bar (n : nat) : nat :=
bar O := O;
bar (S n) := foo n.
from coq-equations.
from coq-equations.
Next on my list, indeed the syntactic check is too crude to determine whether things are mutually recursive or not, I will have to build a dependency graph it seems.
from coq-equations.
Actually, these can't be mutually recursive:
Fixpoint foo (n : nat) : nat :=
bar n
with bar (n : nat) : nat :=
match n with 0 => 0 | S n => foo n end.
Fails.
from coq-equations.
So it's rather that foo is recursive while bar isn't (it's just a definition in this case).
from coq-equations.
Also there are examples where you want the where clause itself to be recursive, that requires a few changes as well.
from coq-equations.
This now works by specifying "by struct fs" for both "sum" and "sum_aux". The fix is in master and will be part of the upcoming release.
from coq-equations.
Related Issues (20)
- Notation conflict with standard library HOT 1
- Please pick the version you prefer for Coq 8.16 in Coq Platform 2022.09 HOT 1
- Exception on invalid syntax
- Merely `Require Equations.Prop.Equations.` breaks the derive plugin shipped in Coq's standard library
- [feature request] Attributes #[transparent/opaque]
- Hang / unlimited memory use with `simp` on trivial function not occurring in Goal HOT 1
- Please pick the version you prefer for Coq 8.17 in Coq Platform 2023.03 HOT 1
- Recursive definition is ill-formed HOT 1
- Anomaly "in Univ.repr: Universe MetaCoq.SafeChecker.PCUICSafeConversion.12667 undefined." Please report at http://coq.inria.fr/bugs/ HOT 2
- Anomaly "in Univ.repr: Universe Var(0) undefined." with `Derive Signature NoConfusion EqDec for Var.`
- `List.chop` throws an exception when a recursive call is missing a parameter
- Please pick the version you prefer for Coq 8.18 in Coq Platform 2023.10 HOT 4
- Many links broken on http://mattam82.github.io/Coq-Equations/ HOT 1
- Potential Bug that crashes coqtop
- Documentation mentions non-existing symbols HOT 1
- Generated elimination principle is missing some induction hypotheses
- Failure to prove functional induction
- Warnings can't be unset
- Crash with Coq 8.19
- Please pick the version you prefer for Coq 8.19 in Coq Platform 2024.01 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coq-equations.