Skip to content

Instantly share code, notes, and snippets.

View rodrigogribeiro's full-sized avatar

Rodrigo Geraldo Ribeiro rodrigogribeiro

View GitHub Profile
@rodrigogribeiro
rodrigogribeiro / gist:1648852
Created January 20, 2012 18:30
Problem with refine tactic
Set Implicit Arguments.
Require Import Arith List.
Definition name := nat
(***********************************************************************)
(** Definition of types. **)
Inductive ty : Set :=
@rodrigogribeiro
rodrigogribeiro / gist:3790334
Created September 26, 2012 20:21
Problem with rewrite.
Set Implicit Arguments.
Require Import Recdef List.
Require Import LibTactics.
Require Import TyOrder Subst Ty Monad Arith_base.
Include SUBST.
Include TYORDER.
@rodrigogribeiro
rodrigogribeiro / gist:8634946
Created January 26, 2014 16:07
Idempotent substitutions in Agda
module Preliminaries where
-- levels
postulate Level : Set
postulate LZero : Level
postulate LSuc : Level -> Level
postulate LMax : Level -> Level -> Level
{-# BUILTIN LEVEL Level #-}
@rodrigogribeiro
rodrigogribeiro / gist:8656836
Created January 27, 2014 20:38
Problems with data constructor injectivity
module Preliminaries where
-- levels
postulate Level : Set
postulate LZero : Level
postulate LSuc : Level -> Level
postulate LMax : Level -> Level -> Level
{-# BUILTIN LEVEL Level #-}
@rodrigogribeiro
rodrigogribeiro / gist:8740167
Created January 31, 2014 18:48
Another annoying problem with Agda
module Preliminaries where
-- levels
postulate Level : Set
postulate LZero : Level
postulate LSuc : Level -> Level
postulate LMax : Level -> Level -> Level
{-# BUILTIN LEVEL Level #-}
@rodrigogribeiro
rodrigogribeiro / gist:9220646
Created February 26, 2014 00:04
Trouble with heterogeneous equality
Set Implicit Arguments.
Require Import Arith.Arith_base List Omega.
Require Import Wellfounded.Lexicographic_Product.
Require Import Relation_Operators.
Require Import JMeq.
(* Notation for heterogeneous equality *)
Infix "==" := JMeq (at level 70, no associativity).
@rodrigogribeiro
rodrigogribeiro / gist:9464436
Created March 10, 2014 12:49
Doubt about dependent pattern matching
Inductive Kind : Set :=
| Star : Kind
| KFun : Kind -> Kind -> Kind.
Definition eq_kind_dec : forall (k k' : Kind), {k = k'} + {k <> k'}.
decide equality.
Defined.
Notation ":*" := Star.
Notation "k '==>' k'" := (KFun k k') (at level 60, right associativity).
@rodrigogribeiro
rodrigogribeiro / gist:976b3d5cc82c970314c2
Created March 25, 2015 14:32
Problem on refining data types indices
open import Data.List
open import Data.Fin hiding (_+_)
open import Data.Nat renaming (ℕ to Nat)
open import Data.Product
open import Data.Vec using (Vec ; lookup)
open import Data.Empty
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality renaming (_≡_ to _==_ ; sym to symm)
module Test (A : Set)(fail : A) where
@rodrigogribeiro
rodrigogribeiro / RegExp.idr
Created October 5, 2015 11:28
Impossible pattern in Idris
module RegExp
%default total
data RegExp : Type where
Zero : RegExp
Eps : RegExp
Chr : Char -> RegExp
Cat : RegExp -> RegExp -> RegExp
Alt : RegExp -> RegExp -> RegExp
@rodrigogribeiro
rodrigogribeiro / RegExp.idr
Created October 5, 2015 11:53
Impossible pattern in Idris (solution)
module RegExp
%default total
data RegExp : Type where
Zero : RegExp
Eps : RegExp
Chr : Char -> RegExp
Cat : RegExp -> RegExp -> RegExp
Alt : RegExp -> RegExp -> RegExp