2014-01-26 00:54:42 +00:00
|
|
|
variable vec : Nat → Type
|
|
|
|
variable concat {n m : Nat} (v : vec n) (w : vec m) : vec (n + m)
|
|
|
|
infixl 65 ; : concat
|
|
|
|
axiom concat_assoc {n1 n2 n3 : Nat} (v1 : vec n1) (v2 : vec n2) (v3 : vec n3) :
|
|
|
|
(v1 ; v2) ; v3 = cast (congr2 vec (symm (Nat::add_assoc n1 n2 n3)))
|
|
|
|
(v1 ; (v2 ; v3))
|
|
|
|
variable empty : vec 0
|
|
|
|
axiom concat_empty {n : Nat} (v : vec n) :
|
|
|
|
v ; empty = cast (congr2 vec (symm (Nat::add_zeror n)))
|
|
|
|
v
|
|
|
|
|
|
|
|
rewrite_set simple
|
|
|
|
add_rewrite Nat::add_assoc Nat::add_zeror eq_id : simple
|
|
|
|
add_rewrite concat_assoc concat_empty Nat::add_assoc Nat::add_zeror : simple
|
|
|
|
|
|
|
|
(*
|
2014-02-04 22:42:28 +00:00
|
|
|
local opts = options({"simplifier", "heq"}, true)
|
2014-01-26 00:54:42 +00:00
|
|
|
local t = parse_lean('λ n : Nat, λ v : vec n, v ; empty')
|
2014-02-04 22:42:28 +00:00
|
|
|
local t2, pr = simplify(t, "simple", opts)
|
2014-01-26 00:54:42 +00:00
|
|
|
print(t2)
|
|
|
|
-- print(pr)
|
|
|
|
get_environment():type_check(pr)
|
|
|
|
*)
|
|
|
|
|
|
|
|
variable f {A : Type} : A → A
|
|
|
|
|
|
|
|
(*
|
2014-02-04 22:42:28 +00:00
|
|
|
local opts = options({"simplifier", "heq"}, true)
|
2014-01-26 00:54:42 +00:00
|
|
|
local t = parse_lean('λ n : Nat, λ v : vec (n + 0), (f v) ; empty')
|
2014-02-04 22:42:28 +00:00
|
|
|
local t2, pr = simplify(t, "simple", opts)
|
2014-01-26 00:54:42 +00:00
|
|
|
print(t2)
|
|
|
|
-- print(pr)
|
|
|
|
get_environment():type_check(pr)
|
|
|
|
*)
|
2014-01-26 08:32:05 +00:00
|
|
|
|
|
|
|
print ""
|
|
|
|
|
|
|
|
variable lheq {A B : TypeM} : A → B → Bool
|
|
|
|
infixl 50 === : lheq
|
|
|
|
(*
|
2014-02-04 22:42:28 +00:00
|
|
|
local opts = options({"simplifier", "heq"}, true)
|
2014-01-26 08:32:05 +00:00
|
|
|
local t = parse_lean('λ val : Nat, (λ n : Nat, λ v : vec (n + 0), (f v) ; empty) val === (λ n : Nat, λ v : vec (n + 0), v) val')
|
|
|
|
print(t)
|
|
|
|
print("=====>")
|
2014-02-04 22:42:28 +00:00
|
|
|
local t2, pr = simplify(t, "simple", opts)
|
2014-01-26 08:32:05 +00:00
|
|
|
print(t2)
|
|
|
|
-- print(pr)
|
|
|
|
get_environment():type_check(pr)
|
|
|
|
*)
|