Giter VIP home page Giter VIP logo

agda-ring-solver's People

Contributors

aljce avatar oisdk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

agda-ring-solver's Issues

Solve doesn't seem to support suc

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.

Solving generic rings

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

Issues regarding the compiler pragmas? (safe, without-K, etc.)

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

Does not type check with recent Agda.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.