Commit 77d73257 authored by charguer's avatar charguer
Browse files

xlet_fixed

parent 011ac52a
Set Implicit Arguments.
Require Import LibTactics CFHeaps CFLib LibInt LibWf Demo_ml.
Require Import LibTactics CFHeaps (* LibInt LibWf *).
Require Import Demo_ml.
Require Import CFLib.
......@@ -7,30 +9,60 @@ Open Scope tag_scope.
(********************************************************************)
(* ** Let-function *)
Lemma let_fun_poly_id_spec :
app let_fun_poly_id [tt] \[] \[= 3].
Proof using.
xcf. xfun. xapp.
Qed.
(********************************************************************)
(* ** Let-pattern *)
Lemma let_pattern_pair_int () =
let (x,y) = (3,4) in
x
Lemma let_fun_poly_pair_homogeneous () =
let f (x:'a) (y:'a) = (x,y) in
f 3 3
Proof using.
xcf.
Qed.
Lemma let_pattern_pair_int_wildcard () =
let (x,_) = (3,4) in
x
Lemma let_fun_on_the_fly () =
(fun x f -> f x) 3 (fun x -> x+1)
Proof using.
xcf.
Qed.
Lemma let_fun_const_spec :
app let_fun_const [tt] \[] \[= 3].
Proof using.
xcf. dup 9.
{ xfun. apply Sf. xrets~. }
{ xfun as g. apply Sg. skip. }
{ xfun as g G. apply G. skip. }
{ xfun_no_simpl (fun g => app g [tt] \[] \[=3]).
{ apply Sf. skip. }
{ apply Sf. } }
{ xfun_no_simpl (fun g => app g [tt] \[] \[=3]) as h.
{ apply Sh. skip. }
{ apply Sh. } }
{ xfun_no_simpl (fun g => app g [tt] \[] \[=3]) as h H.
{ apply H. skip. }
{ apply H. } }
{ xfun (fun g => app g [tt] \[] \[=3]).
{ xrets~. }
{ apply Sf. } }
{ xfun (fun g => app g [tt] \[] \[=3]) as h.
{ skip. }
{ skip. } }
{ xfun (fun g => app g [tt] \[] \[=3]) as h H.
{ skip. }
{ skip. } }
Qed.
(********************************************************************)
(* ** Let-term *)
......@@ -52,38 +84,6 @@ Proof using.
Qed.
(********************************************************************)
(* ** Let-function *)
Lemma let_fun_const () =
let f () = 3 in
f()
Proof using.
xcf.
Qed.
Lemma let_fun_poly_id () =
let f x = x in
f 3
Proof using.
xcf.
Qed.
Lemma let_fun_poly_pair_homogeneous () =
let f (x:'a) (y:'a) = (x,y) in
f 3 3
Proof using.
xcf.
Qed.
Lemma let_fun_on_the_fly () =
(fun x f -> f x) 3 (fun x -> x+1)
Proof using.
xcf.
Qed.
......@@ -255,6 +255,20 @@ Proof using.
Qed.
(********************************************************************)
(* ** Let-pattern *)
Lemma let_pattern_pair_int_spec :
app let_pattern_pair_int [tt] \[] \[= 3].
Proof using. xcf. xmatch. xrets~. Qed.
Lemma let_pattern_pair_int_wildcard_spec :
app let_pattern_pair_int_wildcard [tt] \[] \[= 3].
Proof using. xcf. xmatch. xrets~. Qed.
(********************************************************************)
(********************************************************************)
......
......@@ -590,7 +590,7 @@ let rec cfg_exp env e =
let ncs = List.map (fun (pat,bod) -> (pattern_name_protect_infix pat, cfg_func env' fvs pat bod)) pat_expr_list in
let cf_body = cfg_exp env' body in
add_used_label (fst (List.hd ncs));
Cf_letfunc (ncs, cf_body)
Cf_fun (ncs, cf_body)
(* --todo: check what happens with recursive types *)
(* let-binding of a single value *)
......@@ -624,7 +624,7 @@ let rec cfg_exp env e =
let env' = Ident.add (pattern_ident pat) (List.length fvs_strict) env in
let cf = cfg_exp env' body in
add_used_label x;
Cf_letval (x, fvs_strict, fvs_others, typ, v, cf)
Cf_val (x, fvs_strict, fvs_others, typ, v, cf)
(* term let-binding *)
end else begin
......
......@@ -14,8 +14,8 @@ type cf =
| Cf_body of var * vars * typed_vars * coq * cf
| Cf_let of typed_var * cf * cf
| Cf_letpure of var * vars * vars * coq * cf * cf
| Cf_letval of var * vars * vars * coq * coq * cf
| Cf_letfunc of (var * cf) list * cf
| Cf_val of var * vars * vars * coq * coq * cf
| Cf_fun of (var * cf) list * cf
| Cf_caseif of coq * cf * cf
| Cf_case of coq * typed_vars * coq * coq option *
(typed_var * coq) list * cf * cf
......
......@@ -27,9 +27,9 @@ type cf =
(* Let x := Q1 in Q2 *)
| Cf_letpure of var * vars * vars * coq * cf * cf
(* Let x [Ai,Bi] := Q1 in Q2 // where x : forall Ai.T *)
| Cf_letval of var * vars * vars * coq * coq * cf
| Cf_val of var * vars * vars * coq * coq * cf
(* Let x [Ai,Bi] := v in Q2 // where x : forall Ai.T *)
| Cf_letfunc of (var * cf) list * cf
| Cf_fun of (var * cf) list * cf
(* Let fi := Qi in Q *)
| Cf_caseif of coq * cf * cf
(* If v Then Q1 else Q2 *)
......
......@@ -65,7 +65,7 @@ let rec coqtops_of_imp_cf cf =
let is_spec_k = Coq_app (Coq_var ("is_spec_" ^ sarity), var_k) in
let hyp_k = coq_foralls targs (coq_apps var_k args_of_k) in
let concl_k = coq_apps spec_n [var_k; coq_var f] in
coq_tag "tag_body" (coq_forall_types fvs (coq_foralls ["K", type_of_k] (coq_impls [is_spec_k;hyp_k] concl_k)))
coq_tag "tag_app_curried" (coq_forall_types fvs (coq_foralls ["K", type_of_k] (coq_impls [is_spec_k;hyp_k] concl_k)))
(* (!B: (forall Ai K, is_spec_2 K ->
(forall x1 x2, K x1 x2 F) -> spec_2 K f)) *)
*)
......@@ -79,7 +79,7 @@ let rec coqtops_of_imp_cf cf =
let h_body_2 = Coq_impl (h_body_hyp, h_body_conc) in
let h_body_1 = coq_foralls [("H", hprop); ("Q", Coq_impl (typ, hprop))] h_body_2 in
let h_body = coq_forall_types fvs (coq_foralls targs h_body_1) in
coq_tag "tag_body" (coq_conj h_curried h_body)
coq_tag "tag_app_curried" (coq_conj h_curried h_body)
(* (!B: curried 2 f /\
(forall Ai x1 x2 H Q, CF H Q -> app f [(dyn t1 x1) (dyn t2 x2)] H Q) *)
......@@ -88,17 +88,27 @@ let rec coqtops_of_imp_cf cf =
let type_of_q1 = Coq_impl (typ, hprop) in
let c1 = coq_apps (coq_of_cf cf1) [h; q1] in
let c2 = coq_foralls [x,typ] (coq_apps (coq_of_cf cf2) [(Coq_app (q1, Coq_var x)); q]) in
funhq "tag_let_trm" ~label:x (coq_exist "Q1" type_of_q1 (coq_conj c1 c2))
funhq "tag_let" ~label:x (coq_exist "Q1" type_of_q1 (coq_conj c1 c2))
(* !L: fun H Q => exists Q1, F1 H Q1 /\ forall (x:T), F2 (Q1 x) Q *)
| Cf_letval (x, fvs_strict, fvs_other, typ, v, cf) ->
| Cf_val (x, fvs_strict, fvs_other, typ, v, cf) ->
let type_of_x = coq_forall_types fvs_strict typ in
let equ = coq_eq (Coq_var x) (coq_fun_types fvs_strict v) in
let conc = coq_apps (coq_of_cf cf) [h;q] in
funhq "tag_let_val" (*~label:x*) (Coq_forall ((x, type_of_x), Coq_impl (equ, conc)))
funhq "tag_val" (*~label:x*) (Coq_forall ((x, type_of_x), Coq_impl (equ, conc)))
(*(!!L x: (fun H Q => forall (x:forall Ai,T), x = (fun Ai => v) -> F H Q)) *)
| Cf_letfunc (ncs, cf) ->
| Cf_fun (ncs, cf) ->
let ns, cs = List.split ncs in
let fs = List.map (fun n -> (n, val_type)) ns in
let chyps = List.map coq_of_cf cs in
let cconc = coq_apps (coq_of_cf cf) [h;q] in
let x = List.hd ns in
funhq "tag_fun" ~label:x (coq_foralls fs (coq_impls chyps cconc))
(* (!F a: fun H Q => forall f1 f2, B1 -> B2 -> F H Q) *)
(* DEPRECATED
| Cf_fun (ncs, cf) ->
let ns, cs = List.split ncs in
let p_of n = "P" ^ n in
let fs = List.map (fun n -> (n, val_type)) ns in
......@@ -110,9 +120,10 @@ let rec coqtops_of_imp_cf cf =
let c2conc = coq_apps (coq_of_cf cf) [h;q] in
let c2 = coq_impls c2hyps c2conc in
let x = List.hd ns in
funhq "tag_let_fun" ~label:x (coq_foralls fs (coq_exists ps (coq_conj c1 c2)))
funhq "tag_fun" ~label:x (coq_foralls fs (coq_exists ps (coq_conj c1 c2)))
(* (!F a: fun H Q => forall f1 f2, exists P1 P2,
(B1 -> B2 -> P1 f1 /\ P2 f2) /\ (P1 f1 -> P2 f2 -> F H Q)) *)
*)
(* old
| Cf_caseif (cf0,cf1,cf2) ->
......
......@@ -16,10 +16,10 @@ Require Export CFApp.
Inductive tag_type : Type :=
| tag_ret
| tag_apply
| tag_let_val
| tag_let_fun
| tag_let_trm
| tag_body
| tag_val
| tag_fun
| tag_let
| tag_app_curried
| tag_match (n : nat)
| tag_case
| tag_casewhen
......@@ -107,13 +107,13 @@ Notation "'!Ret' P" := (tag tag_ret (local P))
(at level 69) : tag_scope.
Notation "'!App' P" := (tag tag_apply P)
(at level 95) : tag_scope.
Notation "'!Val' P" := (tag tag_let_val (local P))
Notation "'!Val' P" := (tag tag_val (local P))
(at level 95) : tag_scope.
Notation "'!Fun' P" := (tag tag_let_fun (local P))
Notation "'!Fun' P" := (tag tag_fun (local P))
(at level 95) : tag_scope.
Notation "'!Let' P" := (tag tag_let_trm (local P))
Notation "'!Let' P" := (tag tag_let (local P))
(at level 95) : tag_scope.
Notation "'!Body' P" := (tag tag_body P)
Notation "'!AppCurried' P" := (tag tag_app_curried P)
(at level 95) : tag_scope.
Notation "'!Match' n P" := (tag (tag_match n) P)
......@@ -248,194 +248,199 @@ Notation "'LetVal' x ':=' V 'in' F" :=
(!Val (fun H Q => forall x, x = V -> F H Q))
(at level 69, x ident) : charac.
Notation "'LetVal' [ A1 ] x ':=' V 'in' F" :=
Notation "'LetVal' { A1 } x ':=' V 'in' F" :=
(!Val (fun H Q => forall x, x = (fun (A1:Type) => V) -> F H Q))
(at level 69, x ident, A1 ident) : charac.
Notation "'LetVal' [ A1 A2 ] x ':=' V 'in' F" :=
Notation "'LetVal' { A1 A2 } x ':=' V 'in' F" :=
(!Val (fun H Q => forall x, x = (fun (A1 A2:Type) => V) -> F H Q))
(at level 69, x ident, A1 ident, A2 ident) : charac.
Notation "'LetVal' [ A1 A2 A3 ] x ':=' V 'in' F" :=
Notation "'LetVal' { A1 A2 A3 } x ':=' V 'in' F" :=
(!Val (fun H Q => forall x, x = (fun (A1 A2 A3:Type) => V) -> F H Q))
(at level 69, x ident, A1 ident, A2 ident, A3 ident) : charac.
Notation "'LetVal' [ A1 A2 A3 A4 ] x ':=' V 'in' F" :=
Notation "'LetVal' { A1 A2 A3 A4 } x ':=' V 'in' F" :=
(!Val (fun H Q => forall x, x = (fun (A1 A2 A3 A4:Type) => V) -> F H Q))
(at level 69, x ident, A1 ident, A2 ident, A3 ident, A4 ident) : charac.
(********************************************************************)
(** Body *)
(** AppCurried *)
Notation "'Body' f x1 '=>' K" :=
(!Body ( curried 1 f
Notation "'AppCurried' f '[' x1 ']' ':=' K" :=
(!AppCurried ( curried 1 f
/\ (forall x1 H Q, K H Q -> app f [x1] H Q)))
(at level 0, f at level 0, x1 ident) : charac.
Notation "'Body' f x1 x2 '=>' K" :=
(!Body ( curried 2 f
Notation "'AppCurried' f [ x1 x2 ] ':=' K" :=
(!AppCurried ( curried 2 f
/\ (forall x1 x2 H Q, K H Q -> app f [x1 x2] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident) : charac.
Notation "'Body' f x1 x2 x3 '=>' K" :=
(!Body ( curried 3 f
Notation "'AppCurried' f [ x1 x2 x3 ] ':=' K" :=
(!AppCurried ( curried 3 f
/\ (forall x1 x2 x3 H Q, K H Q -> app f [x1 x2 x3] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, x3 ident) : charac.
Notation "'Body' f x1 x2 x3 x4 '=>' K" :=
(!Body ( curried 4 f
Notation "'AppCurried' f [ x1 x2 x3 x4 ] ':=' K" :=
(!AppCurried ( curried 4 f
/\ (forall x1 x2 x3 x4 H Q, K H Q -> app f [x1 x2 x3 x4] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, x3 ident, x4 ident) : charac.
Notation "'Body' f [ A1 ] x1 '=>' K" :=
(!Body ( curried 1 f
Notation "'AppCurried' f A1 '[' x1 ']' ':=' K" :=
(!AppCurried ( curried 1 f
/\ (forall A1 x1 H Q, K H Q -> app f [x1] H Q)))
(at level 0, f at level 0, x1 ident, A1 ident) : charac.
Notation "'Body' f [ A1 ] x1 x2 '=>' K" :=
(!Body ( curried 2 f
Notation "'AppCurried' f A1 '[' x1 x2 ']' ':=' K" :=
(!AppCurried ( curried 2 f
/\ (forall A1 x1 x2 H Q, K H Q -> app f [x1 x2] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, A1 ident) : charac.
Notation "'Body' f [ A1 ] x1 x2 x3 '=>' K" :=
(!Body ( curried 3 f
Notation "'AppCurried' f A1 [ x1 x2 x3 ] ':=' K" :=
(!AppCurried ( curried 3 f
/\ (forall A1 x1 x2 x3 H Q, K H Q -> app f [x1 x2 x3] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, x3 ident, A1 ident) : charac.
Notation "'Body' f [ A1 ] x1 x2 x3 x4 '=>' K" :=
(!Body ( curried 4 f
Notation "'AppCurried' f A1 [ x1 x2 x3 x4 ] ':=' K" :=
(!AppCurried ( curried 4 f
/\ (forall A1 x1 x2 x3 x4 H Q, K H Q -> app f [x1 x2 x3 x4] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, x3 ident, x4 ident, A1 ident) : charac.
Notation "'Body' f [ A1 A2 ] x1 '=>' K" :=
(!Body ( curried 1 f
Notation "'AppCurried' f A1 A2 [ x1 ] ':=' K" :=
(!AppCurried ( curried 1 f
/\ (forall A1 A2 x1 H Q, K H Q -> app f [x1] H Q)))
(at level 0, f at level 0, x1 ident, A1 ident, A2 ident) : charac.
Notation "'Body' f [ A1 A2 ] x1 x2 '=>' K" :=
(!Body ( curried 2 f
Notation "'AppCurried' f A1 A2 [ x1 x2 ] ':=' K" :=
(!AppCurried ( curried 2 f
/\ (forall A1 A2 x1 x2 H Q, K H Q -> app f [x1 x2] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, A1 ident, A2 ident) : charac.
Notation "'Body' f [ A1 A2 ] x1 x2 x3 '=>' K" :=
(!Body ( curried 3 f
Notation "'AppCurried' f A1 A2 [ x1 x2 x3 ] ':=' K" :=
(!AppCurried ( curried 3 f
/\ (forall A1 A2 x1 x2 x3 H Q, K H Q -> app f [x1 x2 x3] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, x3 ident, A1 ident, A2 ident) : charac.
Notation "'Body' f [ A1 A2 ] x1 x2 x3 x4 '=>' K" :=
(!Body ( curried 4 f
Notation "'AppCurried' f A1 A2 [ x1 x2 x3 x4 ] ':=' K" :=
(!AppCurried ( curried 4 f
/\ (forall A1 A2 x1 x2 x3 x4 H Q, K H Q -> app f [x1 x2 x3 x4] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, x3 ident, x4 ident, A1 ident, A2 ident) : charac.
Notation "'Body' f [ A1 A2 A3 ] x1 '=>' K" :=
(!Body ( curried 1 f
Notation "'AppCurried' f A1 A2 A3 [ x1 ] ':=' K" :=
(!AppCurried ( curried 1 f
/\ (forall A1 A2 A3 x1 H Q, K H Q -> app f [x1] H Q)))
(at level 0, f at level 0, x1 ident, A1 ident, A2 ident, A3 ident) : charac.
Notation "'Body' f [ A1 A2 A3 ] x1 x2 '=>' K" :=
(!Body ( curried 2 f
Notation "'AppCurried' f A1 A2 A3 [ x1 x2 ] ':=' K" :=
(!AppCurried ( curried 2 f
/\ (forall A1 A2 A3 x1 x2 H Q, K H Q -> app f [x1 x2] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, A1 ident, A2 ident, A3 ident) : charac.
Notation "'Body' f [ A1 A2 A3 ] x1 x2 x3 '=>' K" :=
(!Body ( curried 3 f
Notation "'AppCurried' f A1 A2 A3 [ x1 x2 x3 ] ':=' K" :=
(!AppCurried ( curried 3 f
/\ (forall A1 A2 A3 x1 x2 x3 H Q, K H Q -> app f [x1 x2 x3] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, x3 ident, A1 ident, A2 ident, A3 ident) : charac.
Notation "'Body' f [ A1 A2 A3 ] x1 x2 x3 x4 '=>' K" :=
(!Body ( curried 4 f
Notation "'AppCurried' f A1 A2 A3 [ x1 x2 x3 x4 ] ':=' K" :=
(!AppCurried ( curried 4 f
/\ (forall A1 A2 A3 x1 x2 x3 x4 H Q, K H Q -> app f [x1 x2 x3 x4] H Q)))
(at level 0, f at level 0, x1 ident, x2 ident, x3 ident, x4 ident, A1 ident, A2 ident, A3 ident) : charac.
(********************************************************************)
(** LetFun *)
(* [Func] is an auxiliary notation used by [LetFun] *)
(* DEPRECATED
Notation "'Func' f ':=' F1 'in' F2" :=
(!Fun (fun H Q => forall f, exists P1,
(F1 -> P1 f) /\ (P1 f -> F2 H Q)))
(at level 69, f ident) : charac. (* , only parsing *)
*)
Notation "'Func' f ':=' F1 'in' F2" :=
(!Fun (fun H Q => forall f, F1 -> F2 H Q))
(at level 69, f ident) : charac. (* , only parsing *)
Notation "'Fun' f x1 ':=' K 'in' F" :=
(Func f := (Body f x1 => K) in F)
Notation "'Fun' f [ x1 ] ':=' K 'in' F" :=
(Func f := (AppCurried f [ x1 ] := K) in F)
(at level 69, f ident, x1 ident) : charac.
Notation "'Fun' f x1 x2 ':=' K 'in' F" :=
(Func f := (Body f x1 x2 => K) in F)
Notation "'Fun' f [ x1 x2 ] ':=' K 'in' F" :=
(Func f := (AppCurried f [ x1 x2 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident) : charac.
Notation "'Fun' f x1 x2 x3 ':=' K 'in' F" :=
(Func f := (Body f x1 x2 x3 => K) in F)
Notation "'Fun' f [ x1 x2 x3 ] ':=' K 'in' F" :=
(Func f := (AppCurried f [ x1 x2 x3 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, x3 ident) : charac.
Notation "'Fun' f x1 x2 x3 x4 ':=' K 'in' F" :=
(Func f := (Body f x1 x2 x3 x4 => K) in F)
Notation "'Fun' f [ x1 x2 x3 x4 ] ':=' K 'in' F" :=
(Func f := (AppCurried f [ x1 x2 x3 x4 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, x3 ident, x4 ident) : charac.
Notation "'Fun' f [ A1 ] x1 ':=' K 'in' F" :=
(Func f := (Body f [ A1 ] x1 => K) in F)
Notation "'Fun' f A1 [ x1 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 [ x1 ] := K) in F)
(at level 69, f ident, x1 ident, A1 ident) : charac.
Notation "'Fun' f [ A1 ] x1 x2 ':=' K 'in' F" :=
(Func f := (Body f [ A1 ] x1 x2 => K) in F)
Notation "'Fun' f A1 [ x1 x2 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 [ x1 x2 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, A1 ident) : charac.
Notation "'Fun' f [ A1 ] x1 x2 x3 ':=' K 'in' F" :=
(Func f := (Body f [ A1 ] x1 x2 x3 => K) in F)
Notation "'Fun' f A1 [ x1 x2 x3 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 [ x1 x2 x3 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, x3 ident, A1 ident) : charac.
Notation "'Fun' f [ A1 ] x1 x2 x3 x4 ':=' K 'in' F" :=
(Func f := (Body f [ A1 ] x1 x2 x3 x4 => K) in F)
Notation "'Fun' f A1 [ x1 x2 x3 x4 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 [ x1 x2 x3 x4 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, x3 ident, x4 ident, A1 ident) : charac.
Notation "'Fun' f [ A1 A2 ] x1 ':=' K 'in' F" :=
(Func f := (Body f [ A1 A2 ] x1 => K) in F)
Notation "'Fun' f A1 A2 [ x1 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 A2 [ x1 ] := K) in F)
(at level 69, f ident, x1 ident, A1 ident, A2 ident) : charac.
Notation "'Fun' f [ A1 A2 ] x1 x2 ':=' K 'in' F" :=
(Func f := (Body f [ A1 A2 ] x1 x2 => K) in F)
Notation "'Fun' f A1 A2 [ x1 x2 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 A2 [ x1 x2 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, A1 ident, A2 ident) : charac.
Notation "'Fun' f [ A1 A2 ] x1 x2 x3 ':=' K 'in' F" :=
(Func f := (Body f [ A1 A2 ] x1 x2 x3 => K) in F)
Notation "'Fun' f A1 A2 [ x1 x2 x3 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 A2 [ x1 x2 x3 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, x3 ident, A1 ident, A2 ident) : charac.
Notation "'Fun' f [ A1 A2 ] x1 x2 x3 x4 ':=' K 'in' F" :=
(Func f := (Body f [ A1 A2 ] x1 x2 x3 x4 => K) in F)
Notation "'Fun' f A1 A2 [ x1 x2 x3 x4 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 A2 [ x1 x2 x3 x4 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, x3 ident, x4 ident, A1 ident, A2 ident) : charac.
Notation "'Fun' f [ A1 A2 A3 ] x1 ':=' K 'in' F" :=
(Func f := (Body f [ A1 A2 A3 ] x1 => K) in F)
Notation "'Fun' f A1 A2 A3 [ x1 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 A2 A3 [ x1 ] := K) in F)
(at level 69, f ident, x1 ident, A1 ident, A2 ident, A3 ident) : charac.
Notation "'Fun' f [ A1 A2 A3 ] x1 x2 ':=' K 'in' F" :=
(Func f := (Body f [ A1 A2 A3 ] x1 x2 => K) in F)
Notation "'Fun' f A1 A2 A3 [ x1 x2 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 A2 A3 [ x1 x2 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, A1 ident, A2 ident, A3 ident) : charac.
Notation "'Fun' f [ A1 A2 A3 ] x1 x2 x3 ':=' K 'in' F" :=
(Func f := (Body f [ A1 A2 A3 ] x1 x2 x3 => K) in F)
Notation "'Fun' f A1 A2 A3 [ x1 x2 x3 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 A2 A3 [ x1 x2 x3 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, x3 ident, A1 ident, A2 ident, A3 ident) : charac.
Notation "'Fun' f [ A1 A2 A3 ] x1 x2 x3 x4 ':=' K 'in' F" :=
(Func f := (Body f [ A1 A2 A3 ] x1 x2 x3 x4 => K) in F)
Notation "'Fun' f A1 A2 A3 [ x1 x2 x3 x4 ] ':=' K 'in' F" :=
(Func f := (AppCurried f A1 A2 A3 [ x1 x2 x3 x4 ] := K) in F)
(at level 69, f ident, x1 ident, x2 ident, x3 ident, x4 ident, A1 ident, A2 ident, A3 ident) : charac.
(* FUTURE: LetFun for local polymorphic functions *)
(* FUTURE: for mutual rec functions *)
(********************************************************************)
(** LetFuns *)
(** LetFuns
Notation "'Funs' f1 ':=' K1 'and' f2 ':=' K2 'in' F" :=
(!Fun fun H Q => forall f1 f2, exists P1 P2,
......@@ -449,6 +454,7 @@ Notation "'Funs' f1 ':=' K1 'and' f2 ':=' K2 'and' f3 ':=' K3 'in' F" :=
/\ (P1 f1 -> P2 f2 -> P3 f3 -> F H Q))
(at level 69, f1 ident, f2 ident, f3 ident) : charac.
*)
(* TODO: other arities for futual recursion *)
......@@ -672,17 +678,17 @@ Notation "'TopVal' x ':=' Q" :=
(at level 69, x at level 0, Q at level 200)
: charac.
Notation "'TopVal' [ A1 ] x ':=' Q" :=
Notation "'TopVal' '{' A1 '}' x ':=' Q" :=
(!TopVal (forall A1 P, Q (P A1) -> (P A1) x))
(at level 69, x at level 0, A1 ident, Q at level 200)
: charac.
Notation "'TopVal' [ A1 A2 ] x ':=' Q" :=
Notation "'TopVal' '{' A1 A2 '}' x ':=' Q" :=
(!TopVal (forall A1 A2 P, Q (P A1 A2) -> (P A1 A2) x))
(at level 69, x at level 0, A1 ident, A2 ident, Q at level 200)
: charac.
Notation "'TopVal' [ A1 A2 A3 ] x ':=' Q" :=
Notation "'TopVal' '{' A1 A2 A3 '}' x ':=' Q" :=
(!TopVal (forall A1 A2 A3 P, Q (P A1 A2 A3) -> (P A1 A2 A3) x))
(at level 69, x at level 0, A1 ident, A2 ident, A3 ident, Q at level 200)
: charac.
......@@ -820,7 +826,7 @@ Notation "'unfocus'" := database_spec_unfocus.
(* Update tags to:
Definition tag (t:tag_type) `{x:Label} (A:Type) (P:A) := P.
e.g.
Notation "'!B' P" := (tag tag_body _ P)
Notation "'!B' P" := (tag tag_app_curried _ P)
*)