oisdk / agda-ring-solver Goto Github PK
View Code? Open in Web Editor NEWA fast, easy-to-use ring solver for agda with step-by-step solutions
Home Page: https://oisdk.github.io/agda-ring-solver/README.html
License: MIT License
A fast, easy-to-use ring solver for agda with step-by-step solutions
Home Page: https://oisdk.github.io/agda-ring-solver/README.html
License: MIT License
lemma : ∀ n → suc n ≡ suc n * 1
lemma n = solveOver (n ∷ []) Nat.ring
The code above fails with:
/home/amckean/repos/thesis/proofs/Prelude/Nat.agda:123,11-38
n * 1 != n of type ℕ
when checking that the expression
Polynomial.Simple.Solver.Ops.correct {_} {_} Nat.ring {_}
(Polynomial.Expr.Expr._⊗_ {_}
{AlmostCommutativeRing.Carrier {_} {_} Nat.ring} {1}
(Polynomial.Expr.Expr.Κ {_}
{AlmostCommutativeRing.Carrier {_} {_} Nat.ring} {1} (suc n))
(Polynomial.Expr.Expr.Κ {_}
{AlmostCommutativeRing.Carrier {_} {_} Nat.ring} {1} 1))
(Data.Vec.Base.Vec._∷_ {_} {_} {_} n
(Data.Vec.Base.Vec.[] {_} {_}))
has type
(Nat.ring AlmostCommutativeRing.≈
Polynomial.Simple.Solver.Ops.⟦ Nat.ring ⇓⟧
(Polynomial.Expr.Expr.Κ (suc n))
(n Data.Vec.Base.Vec.∷ Data.Vec.Base.Vec.[]))
_k_414
while the following type checks:
lemma : ∀ n → n ≡ n * 1
lemma n = solveOver (n ∷ []) Nat.ring
Is there a way to teach the solver about suc? All my proofs that include suc fail in a similar way.
Hi! First of all, thanks and congrats on completing what seems to be the most advanced solver for Agda, at least as far as reflection is involved (and probably in general).
I'm trying to use it and the code is failing to check, because it seems that a lot of modules in this project use various compiler options such as --safe
, which only allow importing other modules that are also safe
. Unfortunately, many modules in the Agda standard library are currently not safe
, indeed [1] states that
virtually any project relying on the standard library will not be successfully typechecked with the --
safe
option
When I try to type-check e.g. Polynomial.Simple.Reflection
, indeed I get many errors regarding this:
/home/osense/dev/agda-libs/agda-ring-solver/src/Polynomial/Simple/Reflection.agda:5,1-23
Importing module Reflection not using the --safe flag from a module
which does.
when scope checking the declaration
open import Reflection
/home/osense/dev/agda-libs/agda-ring-solver/src/Polynomial/Simple/Reflection.agda:5,1-23
Importing module Reflection not using the --without-K flag from a
module which does.
when scope checking the declaration
open import Reflection
/home/osense/dev/agda-libs/agda-ring-solver/src/Polynomial/Simple/Reflection.agda:5,1-23
Importing module Reflection not using the --no-sized-types flag
from a module which does.
when scope checking the declaration
open import Reflection
/home/osense/dev/agda-libs/agda-ring-solver/src/Polynomial/Simple/Reflection.agda:5,1-23
Importing module Reflection not using the --no-guardedness flag
from a module which does.
when scope checking the declaration
open import Reflection
How do you manage to use the library in the current state? The above is using Agda 2.6.0
and version 0.17
of the standard library, but I have also tried the latest stdlib.
[1] https://agda.readthedocs.io/en/v2.5.4.1/language/safe-agda.html#standard-library
This project does not type check with the recent Agda, looks like Agda's internal types from Agda.Builtin.Reflection
have been pulled out from under it.
This is the error:
/home/kindaro/code/agda/agda-ring-solver/src/Reflection/Helpers.agda:60,17-38
Relevance !=< Modality
when checking that the expression relevant has type Modality
This is the code:
infixr 5 _⋯⟅∷⟆_
_⋯⟅∷⟆_ : ℕ → List (Arg Term) → List (Arg Term)
zero ⋯⟅∷⟆ xs = xs
suc i ⋯⟅∷⟆ xs = unknown ⟅∷⟆ i ⋯⟅∷⟆ xs
{-# INLINE _⋯⟅∷⟆_ #-}
I am trying to build the project with the latest Agda, built from source code today.
open import Level using (_⊔_)
open import Algebra using (CommutativeRing)
open import Data.Maybe using (nothing)
open import Data.List using (List)
open List
module Prelude.Modular {c ℓ} (R : CommutativeRing c ℓ) where
open CommutativeRing R using (_≈_; setoid; 0#; 1#; _+_; _*_; _-_)
renaming (Carrier to C)
open import Polynomial.Simple.AlmostCommutativeRing using (AlmostCommutativeRing; fromCommutativeRing)
open import Polynomial.Simple.Reflection using (solveOver)
ACR : AlmostCommutativeRing c ℓ
ACR = fromCommutativeRing R λ _ → nothing
record _≈_[mod_] (x : C) (y : C) (n : C) : Set (c ⊔ ℓ) where
constructor modulo
field
k : C
x-y≈k*n : x - y ≈ k * n
refl : ∀ {x} {n} → x ≈ x [mod n ]
refl {x} {n} = modulo 0# (solveOver (x ∷ n ∷ []) ACR)
Errors with
CommutativeRing._*_ /= CommutativeRing._+_
when checking that the expression
Polynomial.Simple.Solver.Ops.correct {_} {_} ACR {_}
(Polynomial.Expr.Expr._⊗_ {_}
{AlmostCommutativeRing.Carrier {_} {_} ACR} {2}
(Polynomial.Expr.Expr.Κ {_}
{AlmostCommutativeRing.Carrier {_} {_} ACR} {2}
(CommutativeRing.0# {_} {_} R))
(Polynomial.Expr.Expr.Ι {_}
{AlmostCommutativeRing.Carrier {_} {_} ACR} {2}
(Data.Fin.Base.Fin.zero {_})))
(Data.Vec.Base.Vec._∷_ {_} {_} {_} n
(Data.Vec.Base.Vec._∷_ {_} {_} {_} x
(Data.Vec.Base.Vec.[] {_} {_})))
has type
(ACR AlmostCommutativeRing.≈
Polynomial.Simple.Solver.Ops.⟦ ACR ⇓⟧
(Polynomial.Expr.Expr.Κ (x - x))
(n Data.Vec.Base.Vec.∷ x Data.Vec.Base.Vec.∷ Data.Vec.Base.Vec.[]))
Is it possible to solve rings that aren't currently instantiated
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.