Comments (2)
Yes, you can use derived rules. These are like rules, but you derive them from existing rules. They take the form derive P1 ... P2 -> C
where Pi
are premisess (written as in a rule) and C
is a computation that computes a judgement (from the premises), the conclusion.
let mycong =
derive (A type) ({x : A} B type) (a : A) (b : A) (a ≡ b : A as ξ) ->
congruence B{a} B{b} ξ
;;
rule A type
rule B (x : A) type
rule C (x : A) (y : A) type
rule a : A
rule b : A
rule ξ : a ≡ b : A ;;
mycong A ({x:A} B x) a b ξ ;;
mycong A ({x:A} A) a b ξ ;;
mycong A ({x:A} C x a) a b ξ ;;
from andromeda.
Sorry, I think my example was too simple to get the point across. I had figured out how to write derived rules by reading tests/nucleus/derive.m31
. Right now the AML function I'm trying to write cannot itself be replaced by a derived rule, but somewhere inside of it I need to apply a congruence rule where the "head" is an abstracted metavariable supplied by the user, and I was surprised to discover that using congruence
was unstable because the form of what the user supplied would change the number of arguments required by congruence
. But based on your answer I guess that the solution I had thought of is the intended one, so I'll go that way.
from andromeda.
Related Issues (20)
- Fail gracefully when an atom appears in a derived rule.
- Allow unicode in operators HOT 2
- Abstracting/annotating the result of a recursive call HOT 6
- Fixing typing annotations on recursive functions
- The type of abstraction HOT 1
- Matching against a neutral application HOT 4
- Boundary of an ill-typed equality? HOT 2
- Fix `context`
- Properly implement equality meta-variables, or at least hack them correctly HOT 2
- Fix `coerce`
- Require each module at most once
- Improve the `eq` module
- `open` should be forgotten at the end of a module HOT 3
- Allow patterns in `fun`
- Runtime exceptions are printed in wrong environment
- Printing of local contexts in argument position is reversed
- Failed assertion HOT 1
- Automatic principal arguments in eqchk
- dispatching on arguments that bind variables
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 andromeda.