2014-02-04 23:16:23 +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) :
|
2014-02-07 23:03:16 +00:00
|
|
|
(v1 ; v2) ; v3 = cast (to_heq (congr2 vec (symm (Nat::add_assoc n1 n2 n3))))
|
2014-02-04 23:16:23 +00:00
|
|
|
(v1 ; (v2 ; v3))
|
|
|
|
variable empty : vec 0
|
|
|
|
axiom concat_empty {n : Nat} (v : vec n) :
|
2014-02-07 23:03:16 +00:00
|
|
|
v ; empty = cast (to_heq (congr2 vec (symm (Nat::add_zeror n))))
|
2014-02-04 23:16:23 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
(*
|
|
|
|
local opts = options({"simplifier", "heq"}, true)
|
|
|
|
local t = parse_lean('∀ (n : Nat) (v : vec (n + 0)) (w : vec n), v = w ; empty')
|
|
|
|
print(t)
|
|
|
|
local t2, pr = simplify(t, "simple", heq)
|
|
|
|
print("====>")
|
|
|
|
print(t2)
|
|
|
|
get_environment():type_check(pr)
|
|
|
|
*)
|
|
|
|
|
|
|
|
print "STEP 1"
|
|
|
|
print "STEP 2"
|
|
|
|
|
|
|
|
(*
|
|
|
|
local opts = options({"simplifier", "heq"}, true)
|
|
|
|
local t = parse_lean('λ n : Nat, ∃ (v : vec (n + 0)) (w : vec n), v ≠ w ; empty')
|
|
|
|
print(t)
|
|
|
|
local t2, pr = simplify(t, "simple", opts)
|
|
|
|
print("====>")
|
|
|
|
print(t2)
|
|
|
|
get_environment():type_check(pr)
|
|
|
|
*)
|