fact stringlengths 9 10.6k | type stringclasses 19
values | library stringclasses 6
values | imports listlengths 0 12 | filename stringclasses 101
values | symbolic_name stringlengths 1 48 | docstring stringclasses 1
value |
|---|---|---|---|---|---|---|
showType: Show type := { show := show_type }. | Instance | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/lambda.v | showType | |
show_term(t : term) :=
match t with
| Const n => show n
| Id x => "Id" ++ show x
| App t1 t2 => "(" ++ show_term t1 ++ " " ++ show_term t2 ++ ")"
| Abs t => "λ.(" ++ show_term t ++ ")"
end.
Close Scope string.
#[global] | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/lambda.v | show_term | |
showTerm: Show term := { show := show_term }. | Instance | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/lambda.v | showTerm | |
monad(mon : Type -> Type) :=
{
ret : forall {A : Type}, A -> mon A;
bind : forall {A B : Type}, mon A -> (A -> mon B) -> mon B
}.
Declare Scope monad_scope.
Delimit Scope monad_scope with monad.
Notation "x >>= f" := (bind x f) (at level 50, left associativity) : monad_scope.
Notation "x <- c1 ;; c2" :... | Class | examples | [] | examples/stlc/monad.v | monad | |
liftM{M : Type -> Type} `{monad M} {A B : Type} (f : A -> B)
(m1: M A) : M B :=
n1 <- m1 ;;
ret (f n1). | Definition | examples | [] | examples/stlc/monad.v | liftM | |
liftM2{M : Type -> Type} `{monad M} {A1 A2 B : Type} (f : A1 -> A2 -> B)
(m1: M A1) (m2 : M A2) : M B :=
n1 <- m1 ;;
n2 <- m2 ;;
ret (f n1 n2).
#[global] | Definition | examples | [] | examples/stlc/monad.v | liftM2 | |
optionMonad: monad option :=
{
ret A x := Some x;
bind A B x f :=
match x with
| Some y => f y
| None => None
end
}. | Instance | examples | [] | examples/stlc/monad.v | optionMonad | |
State(St : Type) (A: Type) := St -> (A * St)%type.
#[global] | Definition | examples | [] | examples/stlc/monad.v | State | |
stateMonad{St : Type} : monad (State St) :=
{
ret A x := fun s => (x, s);
bind A B x f :=
fun s =>
let (y, s') := x s in
f y s'
}. | Instance | examples | [] | examples/stlc/monad.v | stateMonad | |
get{St} : State St St := fun st => (st, st). | Definition | examples | [] | examples/stlc/monad.v | get | |
set{St} (ns : St) : State St unit := fun _ => (tt, ns). | Definition | examples | [] | examples/stlc/monad.v | set | |
tvar:= nat. | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | tvar | |
var:= nat. | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | var | |
type: Type :=
| N : type
| Arrow : type -> type -> type. | Inductive | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | type | |
type_eq_dec(t1 t2 : type) : {t1 = t2} + {t1 <> t2}.
Proof. do 2 decide equality. Defined. | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | type_eq_dec | |
type_size(tau : type) : nat :=
match tau with
| N => 0
| Arrow tau1 tau2 =>
1 + (type_size tau1 + type_size tau2)
end. | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | type_size | |
lt_type(tau1 tau2 : type) : Prop :=
type_size tau1 < type_size tau2. | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | lt_type | |
wf_lt_type: well_founded lt_type.
Proof.
unfold lt_type. apply wf_inverse_image. apply lt_wf.
Qed. | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | wf_lt_type | |
term: Type :=
| Const : nat -> term
| Id : var -> term
| App : term -> term -> term
| Abs : term -> term. | Inductive | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | term | |
app_free: term -> Prop :=
| ConsNoApp : forall n, app_free (Const n)
| IdNoApp : forall x, app_free (Id x)
| AbsNoApp : forall (t : term),
app_free t -> app_free (Abs t). | Inductive | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | app_free | |
app_no(t : term) : nat :=
match t with
| Const _ | Id _ => 0
| Abs t => app_no t
| App t1 t2 => 1 + (app_no t1 + app_no t2)
end. | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | app_no | |
env:= list type. | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | env | |
bind: env -> nat -> type -> Prop :=
| BindNow : forall tau env, bind (tau :: env) 0 tau
| BindLater : forall tau tau' x env,
bind env x tau -> bind (tau' :: env) (S x) tau. | Inductive | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | bind | |
typing(e : env) : term -> type -> Prop :=
| TId :
forall x tau,
nth_error e x = Some tau ->
typing e (Id x) tau
| TConst :
forall n,
typing e (Const n) N
| TAbs :
forall t tau1 tau2,
typing (tau1 :: e) t tau2 ->
typing e (Abs t) (Arrow tau1 tau2)
| TApp :
forall t1 t2 tau1 ... | Inductive | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | typing | |
typing'(e : env) : term -> type -> Prop :=
| TId' :
forall x tau,
bind e x tau ->
typing' e (Id x) tau
| TConst' :
forall n,
typing' e (Const n) N
| TAbs' :
forall t tau1 tau2,
typing' (tau1 :: e) t tau2 ->
typing' e (Abs t) (Arrow tau1 tau2)
| TApp' :
forall t1 t2 tau1 tau... | Inductive | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | typing' | |
dec_type(t1 t2 : type) : Dec (t1 = t2).
Proof. dec_eq. Defined.
Derive ArbitrarySizedSuchThat for (fun x => bind env x tau).
Derive ArbitrarySizedSuchThat for (fun t => typing' env t tau). | Instance | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | dec_type | |
ESST_A2(t t1 : type) : EnumSizedSuchThat _ (fun t2 => t = Arrow t1 t2) :=
{ enumSizeST := fun _ => match t with
| Arrow t1' t2 =>
if t1 = t1'? then
returnEnum (Some t2)
else returnEnum None
... | Instance | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | ESST_A2 | |
option_le: option nat -> option nat -> Prop :=
| opt_le_1 : option_le None None
| opt_le_2 : forall n, option_le None (Some n)
| opt_le_3 : forall n m : nat,
n <= m -> option_le (Some n) (Some m).
(* The following keeps track of the size of largest type that appears in a cut
in the de... | Inductive | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | option_le | |
typing_max_tau(e : env) : term -> type -> nat -> Prop :=
| TIdMax :
forall x tau,
nth_error e x = Some tau ->
typing_max_tau e (Id x) tau 0
| TConstMax :
forall n,
typing_max_tau e (Const n) N 0
| TAbsMax :
forall t tau1 tau2 m,
typing_max_tau (tau1 :: e) t tau2 m ->
typing_max... | Inductive | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | typing_max_tau | |
typing_max_tau_correct:
forall e t tau,
(exists m, typing_max_tau e t tau m) <->
typing e t tau.
Proof.
intros. split.
- move => [maxt H]. induction H; econstructor; eauto.
- move => H.
induction H; (try now eexists; econstructor; eauto).
destruct IHtyping as [m H']. exists m. constructor; auto.... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | typing_max_tau_correct | |
typing_max_no_app:
forall e t tau,
app_free t ->
typing e t tau ->
typing_max_tau e t tau 0.
Proof.
intros e t tau H. generalize e tau. clear e tau.
induction H; intros e tau H1; inversion H1; subst; constructor; auto.
Qed. | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | typing_max_no_app | |
is_value(t : term) : bool :=
match t with
| Const _ | Abs _ => true
| _ => false
end. | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | is_value | |
subst(y : var) (t1 : term) (t2 : term) : term :=
match t2 with
| Const n => Const n
| Id x =>
if eq_nat_dec x y then t1 else t2
| App t t' =>
App (subst y t1 t) (subst y t1 t')
| Abs t =>
subst (S y) t1 t
end. | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | subst | |
step(t : term) : option term :=
match t with
| Const _ | Id _ => None | Abs x => None
| App t1 t2 =>
if is_value t1 then
match t1 with
| Abs t =>
if is_value t2 then ret (subst 0 t1 t)
else
t2' <- step t2;;
ret (App t1 t2')
... | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | step | |
gen_type_size(n : nat) : G type :=
match n with
| 0 => returnGen N
| S n' =>
do! m <- choose (0, n');
liftGen2 Arrow (gen_type_size (n' - m)) (gen_type_size (n' - (n' - m)))
end. | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | gen_type_size | |
gen_type: G type := bindGen arbitrary gen_type_size. | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | gen_type | |
vars_with_type(e : env) (tau : type) : list term :=
map (fun p => Id (snd p))
(filter (fun p => proj1_sig (Sumbool.bool_of_sumbool (type_eq_dec tau (fst p))))
(combine e (seq 0 (List.length e)))). | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | vars_with_type | |
sigT_of_prod{A B : Type} (p : A * B) : {_ : A & B} :=
let (a, b) := p in existT (fun _ : A => B) a b. | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | sigT_of_prod | |
lt_pair(c1 c2 : (nat * type)) : Prop :=
lexprod nat (fun _ => type) lt (fun _ => lt_type) (sigT_of_prod c1) (sigT_of_prod c2). | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | lt_pair | |
wf_lt_pair: well_founded lt_pair.
Proof.
unfold lt_pair. apply wf_inverse_image.
apply wf_lexprod. now apply Wf_nat.lt_wf. intros _; now apply wf_lt_type.
Qed. | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | wf_lt_pair | |
gen_term_no_app(tau : type) (e : env) : G term :=
match vars_with_type e tau with
| [] =>
match tau with
| N => liftGen Const arbitrary
| Arrow tau1 tau2 =>
liftGen Abs (gen_term_no_app tau2 (tau1 :: e))
end
| def :: vars =>
oneOf_ (returnGen def)
[ mat... | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | gen_term_no_app | |
Fixpointgen_term_size (p : nat * type) {wf lt_pair p} : env -> G term :=
fun (e : env) => (* apparently with this trick we get a more manageable term *)
match p with
| (0, tau) => gen_term_no_app tau e
| (S n', tau) =>
match vars_with_type e tau with
| [] =>
oneOf_ (gen_term_no_app... | Program | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | Fixpoint | |
gen_term_size_unfold(p : nat * type) (e : env) : G term :=
match p with
| (0, tau) => gen_term_no_app tau e
| (S n', tau) =>
match vars_with_type e tau with
| [] =>
oneOf_ (gen_term_no_app tau e)
[ (do! tau' <- gen_type;
do! m <- choose (0, n');
... | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | gen_term_size_unfold | |
gen_term_size_eq(e : env) (p : nat * type) :
gen_term_size p e =
gen_term_size_unfold p e.
Proof.
unfold_sub gen_term_size (gen_term_size p e); simpl.
destruct p as [[|n] [|]]; try reflexivity;
destruct (vars_with_type e _) eqn:Heq; simpl;
repeat (rewrite !Heq /=; apply f_equal; try reflexivity).
Qed.
Glob... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | gen_term_size_eq | |
gen_term(tau : type) :=
sized (fun s => gen_term_size (s, tau) []).
Open Scope string. | Definition | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | gen_term | |
show_type(tau : type) :=
match tau with
| N => "Nat"
| Arrow tau1 tau2 =>
"(" ++ show_type tau1 ++ " -> " ++ show_type tau2 ++ ")"
end. | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | show_type | |
showType: Show type := { show := show_type }. | Instance | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | showType | |
show_term(t : term) :=
match t with
| Const n => show n
| Id x => "Id" ++ show x
| App t1 t2 => "(" ++ show_term t1 ++ " " ++ show_term t2 ++ ")"
| Abs t => "λ.(" ++ show_term t ++ ")"
end.
Close Scope string. | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | show_term | |
showTerm: Show term := { show := show_term }. | Instance | examples | [
"From mathcomp Require Import ssreflect ssrbool eqtype",
"Require Import Arith List String Lia",
"Require Import Program Relations Wellfounded Lexicographic_Product",
"From QuickChick Require Import QuickChick",
"From QuickChick.stlc Require Import monad"
] | examples/stlc/new.v | showTerm | |
is_some{A} (o : option A) : bool :=
match o with
| Some _ => true
| None => false
end. | Definition | examples | [
"From QuickChick Require Import QuickChick",
"From mathcomp Require Import ssreflect ssrbool",
"From QuickChick.stlc Require Import monad lambda"
] | examples/stlc/test_progress.v | is_some | |
has_progress(t : term) := is_value t || (is_some (step t)). | Definition | examples | [
"From QuickChick Require Import QuickChick",
"From mathcomp Require Import ssreflect ssrbool",
"From QuickChick.stlc Require Import monad lambda"
] | examples/stlc/test_progress.v | has_progress | |
term_size(t : term) : nat :=
match t with
| Const _ | Id _ => 1
| Abs t => 1 + (term_size t)
| App t1 t2 => 1 + (term_size t1 + term_size t2)
end.
QuickCheck (forAll gen_type (fun tau => forAll (gen_term tau) (fun t
=> (collect (append "size " (show (term_size t))) (has_progress t))))). | Fixpoint | examples | [
"From QuickChick Require Import QuickChick",
"From mathcomp Require Import ssreflect ssrbool",
"From QuickChick.stlc Require Import monad lambda"
] | examples/stlc/test_progress.v | term_size | |
step_bug(t : term) : option term :=
match t with
| Const _ | Id _ => None | Abs x => None
| App t1 t2 =>
if is_value t1 then
match t1 with
| Abs t =>
if is_value t2 then ret (subst 0 t1 t)
else None
| _ => None
end
else
t1' <- ... | Definition | examples | [
"From QuickChick Require Import QuickChick",
"From mathcomp Require Import ssreflect ssrbool",
"From QuickChick.stlc Require Import monad lambda"
] | examples/stlc/test_progress.v | step_bug | |
has_progress_bug(t : term) := is_value t || (is_some (step_bug t)).
QuickCheck (forAll gen_type (fun tau =>
forAll (gen_term tau) has_progress_bug)).
QuickCheck (forAll arbitrary (fun tau : type =>
forAll (genST (fun t => typing' nil t tau))
... | Definition | examples | [
"From QuickChick Require Import QuickChick",
"From mathcomp Require Import ssreflect ssrbool",
"From QuickChick.stlc Require Import monad lambda"
] | examples/stlc/test_progress.v | has_progress_bug | |
vars_with_type_shift:
forall e x tau n,
In (Id (S x))
(map (fun p : type * var => Id (snd p))
(filter
(fun p : type * nat =>
proj1_sig (Sumbool.bool_of_sumbool (type_eq_dec tau (fst p))))
(combine e (seq (S n) (length e))))) <->
In (Id x)
... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | vars_with_type_shift | |
vars_with_type_le:
forall e x tau n,
In (Id x)
(map (fun p : type * var => Id (snd p))
(filter
(fun p : type * nat =>
proj1_sig (Sumbool.bool_of_sumbool (type_eq_dec tau (fst p))))
(combine e (seq n (length e))))) -> n <= x.
Proof.
move => e.... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | vars_with_type_le | |
vars_with_type_le_length_aux:
forall e x tau n,
In (Id x)
(map (fun p : type * var => Id (snd p))
(filter
(fun p : type * nat =>
proj1_sig (Sumbool.bool_of_sumbool (type_eq_dec tau (fst p))))
(combine e (seq n (length e))))) -> x < n + (length e... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | vars_with_type_le_length_aux | |
vars_with_type_le_length:
forall e x tau,
In (Id x) (vars_with_type e tau) -> x < (length e).
Proof.
intros. apply vars_with_type_le_length_aux in H.
unfold addn, addn_rec in *. lia.
Qed. | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | vars_with_type_le_length | |
vars_with_type_Id:
forall e tau t,
In t (vars_with_type e tau) -> exists x, t = Id x.
Proof.
intros. rewrite /vars_with_type /= in H.
apply in_map_iff in H. destruct H as [[tau' x] [H1 H2]].
eexists; eauto.
Qed. | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | vars_with_type_Id | |
type_var:
forall e x tau, In (Id x) (vars_with_type e tau) <-> typing e (Id x) tau.
Proof.
induction e as [| tau e IHe]; move => x tau' /=.
- split; intros H;
solve [exfalso; auto |
inversion H; subst; destruct x; simpl in *; discriminate ].
- split; rewrite /vars_with_type /=; intros H;
... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | type_var | |
app_free_app_no_0:
forall (t : term),
app_free t <-> app_no t = 0.
Proof.
elim => [n | x | t1 _ t2 _ | t IHt ]; split; intros H;
solve [ inversion H; (try apply IHt); subst; auto |
constructor; try apply IHt; auto ].
Qed. | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | app_free_app_no_0 | |
Const_leq(s : nat) : term -> Prop :=
| IdLe : forall x, Const_leq s (Id x)
| ConstLe : forall n, n <= s -> Const_leq s (Const n)
| AppLe :
forall t1 t2,
Const_leq s t1 -> Const_leq s t2 ->
Const_leq s (App t1 t2)
| AbsLe :
forall t,
Const_leq s t -> Const_leq s (Abs t). | Inductive | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | Const_leq | |
max_const(t : term) : nat :=
match t with
| Id _ => 0
| Const n => n
| App t1 t2 => max (max_const t1) (max_const t2)
| Abs t => max_const t
end. | Fixpoint | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | max_const | |
Const_leq_trans:
forall t n1 n2,
n1 <= n2 ->
Const_leq n1 t -> Const_leq n2 t.
Proof.
intros. induction t; try (constructor; simpl; lia);
inversion H0; subst;
solve [ constructor; simpl; lia | constructor; eauto ].
Qed. | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | Const_leq_trans | |
max_const_Const_leq:
forall t, Const_leq (max_const t) t.
Proof.
intros. induction t; try (constructor; simpl; lia);
constructor; simpl; eapply Const_leq_trans; try eassumption;
(try now apply PeanoNat.Nat.le_max_l); (try now apply PeanoNat.Nat.le_max_r); lia.
Qed.
(* | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | max_const_Const_leq | |
gen_type_size_correctSize:
forall (n s : nat),
semGenSize (gen_type_size n) s <--> [set tau | type_size tau = n].
Proof.
move => n s tau. elim : tau n s => [| tau1 IH1 tau2 IH2] n s.
{ split.
- destruct n as [| n]; move => H //=.
move : H => /semProdSize
[m1 [/semChooseSize H1 ... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | gen_type_size_correctSize | |
gen_type_correctSize:
forall (s : nat),
semGenSize gen_type s <--> [set tau | type_size tau <= s].
Proof.
intros s. unfold gen_type. rewrite semBindSize => tau.
split => H.
- move : H => [n [/arbNat_correctSize H1 /gen_type_size_correctSize H2]].
lia.
- exists (type_size tau). split. apply arbNat... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | gen_type_correctSize | |
gen_term_no_app_correctSize:
forall (tau : type) (e : env) (s: nat),
semGenSize (gen_term_no_app tau e) s <-->
[set t | typing e t tau /\ app_free t /\ Const_leq s t].
Proof.
induction tau; intros e s; simpl.
- destruct (vars_with_type e N) as [| x e'] eqn:Hvars.
+ rewrite semLiftGenSize. intros t'. ... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | gen_term_no_app_correctSize | |
gen_term_size_correct:
forall (tau : type) (e : env) (n : nat) (s : nat),
semGenSize (gen_term_size (n, tau) e) s <-->
[set t |
(exists maxtau, typing_max_tau e t tau maxtau /\ maxtau <= s) /\
Const_leq s t /\
(exists h, app_no t = h /\ h <= n)].
Proof.
move => tau e n s t.
replace tau wi... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | gen_term_size_correct | |
gen_term_correct:
forall (tau : type),
semGen (gen_term tau) <--> [set t | typing nil t tau].
Proof.
intros.
unfold gen_term. rewrite semSized => t. split.
- move => [s [H1 /gen_term_size_correct [[m [H2 Hle]] [H3 [H4 [H5 H6]]]]]]; subst.
apply typing_max_tau_correct. eexists; eauto.
- move => /typin... | Lemma | examples | [
"From mathcomp Require Import ssreflect ssrbool ssrnat eqtype",
"Require Import String. (* I don't know why we need this.. Probably I am forgetting something *)",
"From QuickChick Require Import QuickChick",
"Require Import Arith List Lia",
"From QuickChick.stlc Require Import lambda",
"Require Import Wel... | examples/stlc/verif.v | gen_term_correct | |
prop_plus_one_againx :=
whenFail (show (x, plus_one x)) (x <? plus_one x). | Definition | examples | [
"From QuickChick Require Import QuickChick",
"Require Import Arith",
"Require Import Foo"
] | examples/multifile-mutation.t/src/Zoo.v | prop_plus_one_again |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.