lean4-htt/tests/lean/run/796.lean
Leonardo de Moura a6cdc333d5 chore: fix tests
2024-02-18 14:14:55 -08:00

59 lines
1.5 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace Ex1
structure A
class B (a : outParam A) (α : Sort u)
class C {a : A} (α : Sort u) [B a α]
class D {a : A} (α : Sort u) [B a α] [c : C α]
class E (a : A) where [c (α : Sort u) [B a α] : C α]
instance c {a : A} [e : E a] (α : Sort u) [B a α] : C α := e.c α
def d {a : A} [E a] (α : Sort u) [B a α] : D α := ⟨⟩
end Ex1
namespace Ex2
class C where f : Sort u → Nat
class D extends C
def a [C] := C.f Nat
def b [D] := D.toC.f Nat
def c [D] := C.f Nat
end Ex2
namespace Ex3
section
variable (N : Type _)
class Zero where
zero : N
export Zero (zero)
class Succ where
succ : N → N
export Succ (succ)
class Succ_Not_Zero [Zero N] [Succ N] where
succ_not_zero {n : N} : succ n ≠ zero
export Succ_Not_Zero (succ_not_zero)
class Eq_Of_Succ_Eq_Succ [Succ N] where
eq_of_succ_eq_succ {n m : N} (h : succ n = succ m) : n = m
export Eq_Of_Succ_Eq_Succ (eq_of_succ_eq_succ)
class Nat_Induction [Zero N] [Succ N] where
nat_induction {P : N → Sort _}
(P0 : P zero)
(ih : (k : N) → P k → P (succ k))
(n : N) : P n
export Nat_Induction (nat_induction)
end
section
variable (N : Type _)
class Natural
extends Zero N, Succ N, Succ_Not_Zero N, Eq_Of_Succ_Eq_Succ N, Nat_Induction N
end
section
variable {} [Natural ]
def pred_with_proof (n : ) (h : n ≠ zero) : Σ' m, n = succ m :=
by
revert h
let P (k : ) := k ≠ zero → Σ' m, k = succ m
exact (nat_induction (by simp [P]; exact False.elim) (λ k _ _ => ⟨k, rfl⟩) n : P n)
def pred (n : ) (h : n ≠ zero) : := (pred_with_proof n h).fst
end
end Ex3